Unified · Split
| @@ -708,7 +708,7 @@ credits = [ · 707 unmodified lines | ||
| 708 | 708 | 'https://raw.githubusercontent.com/saltstack/salt/develop/LICENSE' |
| 709 | 709 | ], [ |
| 710 | 710 | 'Sass', |
| 711 | − '2006-2016 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein', | |
| 711 | + '2006-2020 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein', | |
| 712 | 712 | 'MIT', |
| 713 | 713 | 'https://raw.githubusercontent.com/sass/sass/stable/MIT-LICENSE' |
| 714 | 714 | ], [ |
| @@ -2,62 +2,99 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Sass |
| 3 | 3 | class CleanHtmlFilter < Filter |
| 4 | 4 | def call |
| 5 | − css('tt').each do |node| | |
| 6 | − node.name = 'code' | |
| 5 | + | |
| 6 | + css('.sl-c-alert').remove | |
| 7 | + | |
| 8 | + css('.sl-l-medium-holy-grail__navigation').remove | |
| 9 | + | |
| 10 | + css('.sl-r-banner').remove | |
| 11 | + | |
| 12 | + css('.site-footer').remove | |
| 13 | + | |
| 14 | + # Add id to code blocks | |
| 15 | + css('pre.signature').each do |node| | |
| 16 | + | |
| 17 | + id = node.content | |
| 18 | + | |
| 19 | + if id.match(/\(/) | |
| 20 | + id = id.scan(/.+\(/)[0].chop | |
| 21 | + end | |
| 22 | + | |
| 23 | + if id.include?('$pi') | |
| 24 | + node.set_attribute('id', 'pi') | |
| 25 | + elsif id.include?('$e') | |
| 26 | + node.set_attribute('id', 'e') | |
| 27 | + else | |
| 28 | + node.set_attribute('id', id) | |
| 29 | + end | |
| 30 | + | |
| 7 | 31 | end |
| 8 | 32 | |
| 9 | − css('pre').each do |node| | |
| 10 | − node.content = node.content | |
| 33 | + # Remove duplicate ids | |
| 34 | + css('.sl-c-callout--function').each do |node| | |
| 35 | + node.remove_attribute('id') | |
| 11 | 36 | end |
| 12 | 37 | |
| 13 | − root_page? ? root : other | |
| 38 | + # Hidden title links | |
| 39 | + css('.visuallyhidden').remove | |
| 14 | 40 | |
| 15 | − doc | |
| 16 | − end | |
| 41 | + ### Syntax Highlight ### | |
| 42 | + css('.kt').each do |node| | |
| 43 | + node.remove_attribute('class') | |
| 44 | + node.add_class('token constant') | |
| 45 | + end | |
| 17 | 46 | |
| 18 | − def root | |
| 19 | − at_css('h1 + ul').remove | |
| 20 | − end | |
| 47 | + css('.k, .kn, .kc, .cp, .ow').each do |node| | |
| 48 | + node.remove_attribute('class') | |
| 49 | + node.add_class('token keyword') | |
| 50 | + end | |
| 21 | 51 | |
| 22 | − def other | |
| 23 | − at_css('h2').remove | |
| 52 | + css('.nv, .no').each do |node| | |
| 53 | + node.remove_attribute('class') | |
| 54 | + node.add_class('token variable') | |
| 55 | + end | |
| 24 | 56 | |
| 25 | − css('.showSource', '.source_code').remove | |
| 57 | + css('.nb, .n').each do |node| | |
| 58 | + node.remove_attribute('class') | |
| 59 | + node.add_class('token string') | |
| 60 | + end | |
| 26 | 61 | |
| 27 | − css('div.docstring', 'div.discussion').each do |node| | |
| 28 | − node.before(node.children).remove | |
| 62 | + css('.p').each do |node| | |
| 63 | + node.remove_attribute('class') | |
| 64 | + node.add_class('token punctuation') | |
| 29 | 65 | end |
| 30 | 66 | |
| 31 | − # Remove "See Also" | |
| 32 | − css('.see').each do |node| | |
| 33 | − node.previous_element.remove | |
| 34 | − node.remove | |
| 67 | + css('.nf').each do |node| | |
| 68 | + node.remove_attribute('class') | |
| 69 | + node.add_class('token function') | |
| 35 | 70 | end |
| 36 | 71 | |
| 37 | − # Remove "- ([...])" before method names | |
| 38 | − css('.signature', 'span.overload', 'span.signature').each do |node| | |
| 39 | − next if node.at_css('.overload') | |
| 40 | − node.child.remove while node.child.name != 'strong' | |
| 72 | + css('.o').each do |node| | |
| 73 | + node.remove_attribute('class') | |
| 74 | + node.add_class('token operator') | |
| 41 | 75 | end |
| 42 | 76 | |
| 43 | − # Clean up .inline divs | |
| 44 | − css('div.inline').each do |node| | |
| 45 | − node.content = node.content | |
| 46 | − node.name = 'span' | |
| 77 | + css('.c1, .cm, .c').each do |node| | |
| 78 | + node.remove_attribute('class') | |
| 79 | + node.add_class('token comment') | |
| 47 | 80 | end |
| 48 | 81 | |
| 49 | − # Remove links to type classes (e.g. Number) | |
| 50 | − css('.type > code').each do |node| | |
| 51 | − node.before(node.content.remove('Sass::Script::Value::').remove('Sass::Script::')).remove | |
| 82 | + css('.mh, .m, .mi').each do |node| | |
| 83 | + node.remove_attribute('class') | |
| 84 | + node.add_class('token number') | |
| 52 | 85 | end |
| 53 | 86 | |
| 54 | − css('li > span.signature').each do |node| | |
| 55 | − node.name = 'p' | |
| 87 | + css('.nc, .nt').each do |node| | |
| 88 | + node.remove_attribute('class') | |
| 89 | + node.add_class('token selector') | |
| 56 | 90 | end |
| 57 | 91 | |
| 58 | − css('h3 strong', 'span.overload').each do |node| | |
| 59 | − node.before(node.children).remove | |
| 92 | + css('.nl').each do |node| | |
| 93 | + node.remove_attribute('class') | |
| 94 | + node.add_class('token property') | |
| 60 | 95 | end |
| 96 | + | |
| 97 | + doc | |
| 61 | 98 | end |
| 62 | 99 | end |
| 63 | 100 | end |
| @@ -1,89 +1,53 @@ | ||
| 1 | 1 | module Docs |
| 2 | 2 | class Sass |
| 3 | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | − TYPES = ['CSS Extensions', 'SassScript', '@-Rules and Directives', | |
| 5 | − 'Output Styles'] | |
| 6 | − | |
| 7 | − SKIP_NAMES = ['Interactive Shell', 'Data Types', 'Operations', | |
| 8 | − 'Division and /', 'Keyword Arguments'] | |
| 9 | − | |
| 10 | − REPLACE_NAMES = { | |
| 11 | − '%foo' => '%placeholder selector', | |
| 12 | − '&' => '& parent selector', | |
| 13 | − '$' => '$ variables', | |
| 14 | − '`' => '#{} interpolation', | |
| 15 | − 'The !optional Flag' => '!optional' | |
| 16 | − } | |
| 17 | 4 | |
| 18 | 5 | def get_name |
| 19 | − 'Functions' | |
| 6 | + at_css('#main-content > h1').content | |
| 20 | 7 | end |
| 21 | 8 | |
| 22 | 9 | def get_type |
| 23 | − 'Functions' | |
| 10 | + return 'Syntax' if slug.include?('syntax') | |
| 11 | + return 'Style rules' if slug.include?('style') | |
| 12 | + return 'At-Rules' if slug.include?('at') | |
| 13 | + return 'Values' if slug.include?('values') | |
| 14 | + return 'Operators' if slug.include?('operators') | |
| 15 | + return 'Command line' if slug.include?('cli') | |
| 16 | + return 'Modules' if slug.include?('modules') | |
| 17 | + 'Misc' | |
| 24 | 18 | end |
| 25 | 19 | |
| 26 | 20 | def additional_entries |
| 27 | − root_page? ? root_entries : function_entries | |
| 28 | − end | |
| 29 | − | |
| 30 | − def root_entries | |
| 31 | 21 | entries = [] |
| 32 | − type = '' | |
| 33 | − | |
| 34 | − css('*').each do |node| | |
| 35 | − if node.name == 'h2' | |
| 36 | − type = node.content.strip | |
| 37 | − type.remove! %r{\s#.*} | |
| 38 | − node['id'] = type.parameterize | |
| 39 | − | |
| 40 | − if type == 'Function Directives' | |
| 41 | − entries << ['@function', node['id'], '@-Rules and Directives'] | |
| 42 | − end | |
| 43 | − | |
| 44 | − if type.include? 'Directives' | |
| 45 | − type = '@-Rules and Directives' | |
| 46 | − elsif type == 'Output Style' | |
| 47 | − type = 'Output Styles' | |
| 48 | − end | |
| 49 | 22 | |
| 50 | − next | |
| 51 | − elsif node.name == 'h3' || node.name == 'h4' | |
| 52 | − next unless TYPES.include?(type) | |
| 23 | + signatureElement = css('.signature') | |
| 53 | 24 | |
| 54 | − name = node.content.strip | |
| 55 | − name.remove! %r{\A.+?: } | |
| 56 | − name.remove! %r{\s#.*} | |
| 25 | + if signatureElement | |
| 57 | 26 | |
| 58 | − node['id'] = name.parameterize | |
| 27 | + signatureElement.each do |node| | |
| 59 | 28 | |
| 60 | − next if SKIP_NAMES.include?(name) | |
| 29 | + entry_name = node.content | |
| 61 | 30 | |
| 62 | − name = REPLACE_NAMES[name] if REPLACE_NAMES[name] | |
| 63 | − name.gsub!(/ [A-Z]/) { |str| str.downcase! } | |
| 31 | + if entry_name.match(/\(/) | |
| 32 | + entry_name = entry_name.scan(/.+\(/)[0].chop | |
| 33 | + end | |
| 64 | 34 | |
| 65 | − if type == '@-Rules and Directives' | |
| 66 | − next unless name =~ /\A@[\w\-]+\z/ || name == '!optional' | |
| 35 | + if entry_name.include?('$pi') | |
| 36 | + entries << [entry_name, 'pi', 'Variable'] | |
| 37 | + elsif entry_name.include?('$e') | |
| 38 | + entries << [entry_name, 'e', 'Variable'] | |
| 39 | + else | |
| 40 | + entries << [entry_name, entry_name, 'Functions'] | |
| 67 | 41 | end |
| 68 | 42 | |
| 69 | − entries << [name, node['id'], type] | |
| 70 | 43 | end |
| 44 | + | |
| 71 | 45 | end |
| 72 | 46 | |
| 73 | 47 | entries |
| 74 | − end | |
| 75 | − | |
| 76 | − def function_entries | |
| 77 | − css('.method_details > .signature').inject [] do |entries, node| | |
| 78 | − name = node.content.strip.remove(%r{\(.*}) | |
| 79 | 48 | |
| 80 | − unless name == entries.last.try(:first) | |
| 81 | − entries << [name, node['id'], 'Functions'] | |
| 82 | − end | |
| 83 | − | |
| 84 | − entries | |
| 85 | − end | |
| 86 | 49 | end |
| 50 | + | |
| 87 | 51 | end |
| 88 | 52 | end |
| 89 | 53 | end |
| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | module Docs |
| 2 | 2 | class Sass < UrlScraper |
| 3 | 3 | self.type = 'yard' |
| 4 | − self.release = '3.5.3' | |
| 5 | − self.base_url = 'http://sass-lang.com/documentation/' | |
| 6 | − self.root_path = 'file.SASS_REFERENCE.html' | |
| 4 | + self.release = '3.6.4' | |
| 5 | + self.base_url = 'https://sass-lang.com/documentation' | |
| 6 | + self.root_path = 'index.html' | |
| 7 | 7 | self.links = { |
| 8 | 8 | home: 'http://sass-lang.com/', |
| 9 | 9 | code: 'https://github.com/sass/sass' |
| @@ -11,21 +11,21 @@ module Docs · 1 unmodified line | ||
| 11 | 11 | |
| 12 | 12 | html_filters.push 'sass/clean_html', 'sass/entries', 'title' |
| 13 | 13 | |
| 14 | − options[:only] = %w(Sass/Script/Functions.html) | |
| 15 | 14 | options[:root_title] = false |
| 16 | 15 | options[:title] = 'Sass Functions' |
| 17 | 16 | |
| 18 | − options[:container] = ->(filter) do | |
| 19 | − filter.root_page? ? '#filecontents' : '#instance_method_details' | |
| 20 | − end | |
| 17 | + options[:skip_patterns] = [/breaking-changes/] | |
| 18 | + | |
| 19 | + # options[:container] = '#main-content' | |
| 21 | 20 | |
| 22 | 21 | options[:attribution] = <<-HTML |
| 23 | − © 2006–2016 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein<br> | |
| 22 | + © 2006–2020 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein<br> | |
| 24 | 23 | Licensed under the MIT License. |
| 25 | 24 | HTML |
| 26 | 25 | |
| 27 | 26 | def get_latest_version(opts) |
| 28 | 27 | get_latest_github_release('sass', 'libsass', opts) |
| 29 | 28 | end |
| 29 | + | |
| 30 | 30 | end |
| 31 | 31 | end |