Finish Liquid scraper

pull/500/merge
Thibaut Courouble 8 years ago
parent dfee92d4f4
commit 22461b057d

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 142 KiB

@ -1,5 +1,8 @@
[
[
"2017-05-14",
"New documentation: <a href=\"/liquid/\">Liquid</a>"
], [
"2017-04-30",
"New documentation: <a href=\"/openjdk/\">OpenJDK</a>"
], [

@ -323,6 +323,11 @@ credits = [
'2009-2016 The Core Less Team',
'CC BY',
'https://creativecommons.org/licenses/by/3.0/'
], [
'Liquid',
'2005, 2006 Tobias Luetke',
'MIT',
'https://raw.githubusercontent.com/Shopify/liquid/master/LICENSE'
], [
'Lo-Dash',
'2012-2016 The Dojo Foundation',

@ -43,6 +43,7 @@
%icon-clipboard-white { background-position: -1rem -2rem; }
%icon-close-white { background-position: -2rem -2rem; }
._icon-liquid:before { background-position: -1rem 0; }
._icon-openjdk:before { background-position: -2rem 0; }
._icon-codeceptjs:before { background-position: -3rem 0; }
._icon-codeception:before { background-position: -4rem 0; }

@ -1,18 +1,5 @@
._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;
}
p.code-label { @extend %pre-heading; }
}

@ -2,29 +2,16 @@ 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')
@doc = at_css('.content__area > .content')
css('button.menu-button').remove
css('.home-banner', '.menu-button', '#used-by', '#used-by ~ *').remove
css('code').each do |node|
node.remove_attribute('class')
node.content = node.content
css('.highlighter-rouge').each do |node|
node.before(node.children).remove
end
css('pre', '.highlighter-rouge').each do |node|
node.remove_attribute('class')
css('pre').each do |node|
node.content = node.content.strip
end
doc

@ -6,23 +6,16 @@ module Docs
end
def get_type
if not root_page?
slug.split('/').first.capitalize
end
slug.split('/').first.capitalize
end
def additional_entries
entries = []
return [] unless type == 'Tags'
if get_type == 'Tags'
css('h2').each do |node|
entries << [node.content, node['id']]
end
css('h2').map do |node|
[node.content, node['id']]
end
entries
end
end
end
end

@ -2,18 +2,21 @@ module Docs
class Liquid < UrlScraper
self.name = 'Liquid'
self.type = 'liquid'
self.base_url = "https://shopify.github.io/liquid/"
self.base_url = 'https://shopify.github.io/liquid/'
self.release = '4.0.0'
self.links = {
home: 'http://liquidmarkup.org/',
code: 'https://github.com/shopify/liquid'
home: 'https://shopify.github.io/liquid/',
code: 'https://github.com/Shopify/liquid'
}
html_filters.push 'liquid/entries', 'liquid/clean_html'
html_filters.push 'liquid/entries', 'liquid/clean_html', 'title'
options[:title] = false
options[:root_title] = 'Liquid'
options[:attribution] = <<-HTML
&copy; 2005, 2006 Tobias Luetke<br>
Licensed under the MIT License.
HTML
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 847 B

@ -1 +0,0 @@
https://shopify.github.io/liquid/images/icons/water-drop-64x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Loading…
Cancel
Save