From dfee92d4f4ab350bb00d008363bfb813c84d58d0 Mon Sep 17 00:00:00 2001 From: Phil Scherer Date: Sat, 6 May 2017 00:29:24 -0500 Subject: [PATCH] Add Liquid documentation --- assets/stylesheets/application-dark.css.scss | 1 + assets/stylesheets/application.css.scss | 1 + assets/stylesheets/pages/_liquid.scss | 18 ++++++++++ lib/docs/filters/liquid/clean_html.rb | 34 +++++++++++++++++++ lib/docs/filters/liquid/entries.rb | 28 +++++++++++++++ lib/docs/scrapers/liquid.rb | 19 +++++++++++ public/icons/docs/liquid/SOURCE | 1 + public/icons/docs/liquid/water-drop-64x.png | Bin 0 -> 3988 bytes 8 files changed, 102 insertions(+) create mode 100644 assets/stylesheets/pages/_liquid.scss create mode 100644 lib/docs/filters/liquid/clean_html.rb create mode 100644 lib/docs/filters/liquid/entries.rb create mode 100644 lib/docs/scrapers/liquid.rb create mode 100644 public/icons/docs/liquid/SOURCE create mode 100644 public/icons/docs/liquid/water-drop-64x.png 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 0000000000000000000000000000000000000000..64b55c4d14a1fc55534f0725d6435c6e8e9a5ec7 GIT binary patch literal 3988 zcmV;F4{Pv=P)2&6sY3G~g>*v#{I-S;OZ9iu^&$QLL0AZ0G5i7W`h{_rkWt9-tBoLC^`~4Ab zWPEDL&BE`m^LyTV-t*qyJ?EZt-g7Sk%M2!y$xBP${ANr{+%C`6t9><^c}-VG=k2oc z($jZZnlBIpp4RihO<71pS;HK@h~t+dEjR)nV;z_bZkwE_AsXie9&VPe4FmH~@f7r_&eY zU;6sj?;TG3{eS&7>+apwn*abPiXxektT$GyaQ0oUxR#{{(CKu$g9qO{v%=Y#kK;IT zegkVG=KI zp8x;=tyZfo$h&xK@ykxBRE`!GNxvj{TKeXf?77^P%MqK+1wc`ho|Th(1VvE<0O010 z8|8yTLrqU#S9|5kHwuM94glcf9@2rUF+@Xx%#YYD=W%RO;1lx z0|4;(e11}L%6?nNXHx+@JUur?Mn!D|FueH-3kr_^(n4o?daA#sy6P;+C0RL#P!wg^ zGDe#Uke##B`1Cv4+nd|k?w2i9=WHa0FD z0075vTq?~!iR1XfQuXBWv9@b+Nc4 zYP@J_-NHiY35`ah0RZq^z1lY-GBVdzaoR)x7Z-j&LPDa13f2Lwd;2Lx`mMXXjAz|qmsBQ-6356O!PrJw6`Iu*&;Y&QQl zAN=-Wc24f0-+%a#lt!aD{G6ZO-k#dlJ1q?W0CYN?mX)1z#1`>d-QlLxwEuK)aBu_w zn4FlHtgI;i+hTii%BBOZLXjH)0E*InseR)7`EwuRI8Fcngoj6L@bdOfuy(vw6@X)J zFWjt2!<7D`X)bh;UmvpF2WjvW%?61TXh@Eg5eKLgJ|M|*ooS7+y4000Jq!N|6wc1(k~XJsYXc7X0!R*Gcyl7v0whj^z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