Update Sass documentation (3.5.1)

pull/666/merge
Thibaut Courouble 7 years ago
parent f89c9aeda1
commit 3e0193cdea

@ -1,16 +1,5 @@
._yard { ._yard {
> h2 { @extend %block-heading; } @extend %simple;
.signature { @extend %block-label, %label-blue; }
> .method_details {
padding-left: 1rem;
> .signature { margin-left: -1rem; }
> .signature .overload { display: block; }
h3 { font-size: inherit; }
ul, pre { margin: 1em 0; }
}
.tag_title { font-weight: $boldFontWeight; } .tag_title { font-weight: $boldFontWeight; }
} }

@ -6,13 +6,17 @@ module Docs
node.name = 'code' node.name = 'code'
end end
css('pre').each do |node|
node.content = node.content
end
root_page? ? root : other root_page? ? root : other
doc doc
end end
def root def root
at_css('.maruku_toc').remove at_css('h1 + ul').remove
end end
def other def other
@ -46,6 +50,14 @@ module Docs
css('.type > code').each do |node| css('.type > code').each do |node|
node.before(node.content.remove('Sass::Script::Value::').remove('Sass::Script::')).remove node.before(node.content.remove('Sass::Script::Value::').remove('Sass::Script::')).remove
end end
css('li > span.signature').each do |node|
node.name = 'p'
end
css('h3 strong', 'span.overload').each do |node|
node.before(node.children).remove
end
end end
end end
end end

@ -15,8 +15,12 @@ module Docs
'The !optional Flag' => '!optional' 'The !optional Flag' => '!optional'
} }
def include_default_entry? def get_name
false 'Functions'
end
def get_type
'Functions'
end end
def additional_entries def additional_entries
@ -27,9 +31,11 @@ module Docs
entries = [] entries = []
type = '' type = ''
css('> [id]').each do |node| css('*').each do |node|
if node.name == 'h2' if node.name == 'h2'
type = node.content.strip type = node.content.strip
type.remove! %r{\s#.*}
node['id'] = type.parameterize
if type == 'Function Directives' if type == 'Function Directives'
entries << ['@function', node['id'], '@-Rules and Directives'] entries << ['@function', node['id'], '@-Rules and Directives']
@ -42,23 +48,26 @@ module Docs
end end
next next
end elsif node.name == 'h3' || node.name == 'h4'
next unless TYPES.include?(type)
next unless TYPES.include?(type) name = node.content.strip
name.remove! %r{\A.+?: }
name.remove! %r{\s#.*}
name = node.content.strip node['id'] = name.parameterize
name.remove! %r{\A.+?: }
next if SKIP_NAMES.include?(name) next if SKIP_NAMES.include?(name)
name = REPLACE_NAMES[name] if REPLACE_NAMES[name] name = REPLACE_NAMES[name] if REPLACE_NAMES[name]
name.gsub!(/ [A-Z]/) { |str| str.downcase! } name.gsub!(/ [A-Z]/) { |str| str.downcase! }
if type == '@-Rules and Directives' if type == '@-Rules and Directives'
next unless name =~ /\A@[\w\-]+\z/ || name == '!optional' next unless name =~ /\A@[\w\-]+\z/ || name == '!optional'
end end
entries << [name, node['id'], type] entries << [name, node['id'], type]
end
end end
entries entries
@ -66,7 +75,7 @@ module Docs
def function_entries def function_entries
css('.method_details > .signature').inject [] do |entries, node| css('.method_details > .signature').inject [] do |entries, node|
name = node.at_css('strong').content.strip name = node.content.strip.remove(%r{\(.*})
unless name == entries.last.try(:first) unless name == entries.last.try(:first)
entries << [name, node['id'], 'Functions'] entries << [name, node['id'], 'Functions']

@ -1,9 +1,13 @@
module Docs module Docs
class Sass < UrlScraper class Sass < UrlScraper
self.type = 'yard' self.type = 'yard'
self.release = '3.4.22' self.release = '3.5.1'
self.base_url = 'http://sass-lang.com/documentation/' self.base_url = 'http://sass-lang.com/documentation/'
self.root_path = 'file.SASS_REFERENCE.html' self.root_path = 'file.SASS_REFERENCE.html'
self.links = {
home: 'http://sass-lang.com/',
code: 'https://github.com/sass/sass'
}
html_filters.push 'sass/clean_html', 'sass/entries', 'title' html_filters.push 'sass/clean_html', 'sass/entries', 'title'

Loading…
Cancel
Save