diff --git a/assets/stylesheets/application-dark.css.scss b/assets/stylesheets/application-dark.css.scss index f9030ca5..ffdb1831 100644 --- a/assets/stylesheets/application-dark.css.scss +++ b/assets/stylesheets/application-dark.css.scss @@ -57,6 +57,7 @@ 'pages/knockout', 'pages/kotlin', 'pages/laravel', + 'pages/liquid', 'pages/love', 'pages/lua', 'pages/mdn', diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index d83f9dd0..54f8e858 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -57,6 +57,7 @@ 'pages/knockout', 'pages/kotlin', 'pages/laravel', + 'pages/liquid', 'pages/love', 'pages/lua', 'pages/mdn', diff --git a/assets/stylesheets/pages/_liquid.scss b/assets/stylesheets/pages/_liquid.scss new file mode 100644 index 00000000..55ad0abb --- /dev/null +++ b/assets/stylesheets/pages/_liquid.scss @@ -0,0 +1,18 @@ +._liquid { + @extend %simple; + + .code-label { + @extend %block-label, %label-green; + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; + margin-left: 0; + margin-right: 0; + margin-bottom: -1px; + } + + .code-label ~ div > pre { + margin-top: 0; + border-top-left-radius: 0; + border-top-right-radius: 0; + } +} diff --git a/lib/docs/filters/liquid/clean_html.rb b/lib/docs/filters/liquid/clean_html.rb new file mode 100644 index 00000000..1086d70d --- /dev/null +++ b/lib/docs/filters/liquid/clean_html.rb @@ -0,0 +1,34 @@ +module Docs + class Liquid + class CleanHtmlFilter < Filter + def call + root_page? ? root : other + end + + def root + doc = at_css('.home-banner') + + css('.btn-row').remove + + doc + end + + def other + doc = at_css('.content__area > .content') + + css('button.menu-button').remove + + css('code').each do |node| + node.remove_attribute('class') + node.content = node.content + end + + css('pre', '.highlighter-rouge').each do |node| + node.remove_attribute('class') + end + + doc + end + end + end +end diff --git a/lib/docs/filters/liquid/entries.rb b/lib/docs/filters/liquid/entries.rb new file mode 100644 index 00000000..b984a463 --- /dev/null +++ b/lib/docs/filters/liquid/entries.rb @@ -0,0 +1,28 @@ +module Docs + class Liquid + class EntriesFilter < Docs::EntriesFilter + def get_name + at_css('h1').content + end + + def get_type + if not root_page? + slug.split('/').first.capitalize + end + end + + def additional_entries + entries = [] + + if get_type == 'Tags' + css('h2').each do |node| + entries << [node.content, node['id']] + end + end + + entries + end + + end + end +end diff --git a/lib/docs/scrapers/liquid.rb b/lib/docs/scrapers/liquid.rb new file mode 100644 index 00000000..af06314d --- /dev/null +++ b/lib/docs/scrapers/liquid.rb @@ -0,0 +1,19 @@ +module Docs + class Liquid < UrlScraper + self.name = 'Liquid' + self.type = 'liquid' + self.base_url = "https://shopify.github.io/liquid/" + self.links = { + home: 'http://liquidmarkup.org/', + code: 'https://github.com/shopify/liquid' + } + + html_filters.push 'liquid/entries', 'liquid/clean_html' + + options[:attribution] = <<-HTML + © 2005, 2006 Tobias Luetke
+ Licensed under the MIT License. + HTML + + end +end diff --git a/public/icons/docs/liquid/SOURCE b/public/icons/docs/liquid/SOURCE new file mode 100644 index 00000000..8050d8ca --- /dev/null +++ b/public/icons/docs/liquid/SOURCE @@ -0,0 +1 @@ +https://shopify.github.io/liquid/images/icons/water-drop-64x.png diff --git a/public/icons/docs/liquid/water-drop-64x.png b/public/icons/docs/liquid/water-drop-64x.png new file mode 100644 index 00000000..64b55c4d Binary files /dev/null and b/public/icons/docs/liquid/water-drop-64x.png differ