History

Update Sass to 3.6.4

MasterEnoc committed 5 years ago

Commit 2e33ebc1 parent 81abc5a4 files · +104 −103Browse files

Unified · Split

4 files
  1. assets/javascripts/templates/pages/about_tmpl.coffee +1 −1
  2. lib/docs/filters/sass/clean_html.rb +71 −34
  3. lib/docs/filters/sass/entries.rb +24 −60
  4. lib/docs/scrapers/sass.rb +8 −8
assets/javascripts/templates/pages/about_tmpl.coffee+1−1
@@ -708,7 +708,7 @@ credits = [ · 707 unmodified lines
708 'https://raw.githubusercontent.com/saltstack/salt/develop/LICENSE'708 'https://raw.githubusercontent.com/saltstack/salt/develop/LICENSE'
709 ], [709 ], [
710 'Sass',710 'Sass',
711 '2006-2016 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein',711 '2006-2020 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein',
712 'MIT',712 'MIT',
713 'https://raw.githubusercontent.com/sass/sass/stable/MIT-LICENSE'713 'https://raw.githubusercontent.com/sass/sass/stable/MIT-LICENSE'
714 ], [714 ], [
lib/docs/filters/sass/clean_html.rb+71−34
@@ -2,62 +2,99 @@ module Docs · 1 unmodified line
2 class Sass2 class Sass
3 class CleanHtmlFilter < Filter3 class CleanHtmlFilter < Filter
4 def call4 def call
5 css('tt').each do |node|5
6 node.name = 'code'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 end31 end
8 32
9 css('pre').each do |node|33 # Remove duplicate ids
10 node.content = node.content34 css('.sl-c-callout--function').each do |node|
35 node.remove_attribute('id')
11 end36 end
12 37
13 root_page? ? root : other38 # Hidden title links
39 css('.visuallyhidden').remove
14 40
15 doc41 ### Syntax Highlight ###
16 end42 css('.kt').each do |node|
43 node.remove_attribute('class')
44 node.add_class('token constant')
45 end
17 46
18 def root47 css('.k, .kn, .kc, .cp, .ow').each do |node|
19 at_css('h1 + ul').remove48 node.remove_attribute('class')
20 end49 node.add_class('token keyword')
50 end
21 51
22 def other52 css('.nv, .no').each do |node|
23 at_css('h2').remove53 node.remove_attribute('class')
54 node.add_class('token variable')
55 end
24 56
25 css('.showSource', '.source_code').remove57 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|62 css('.p').each do |node|
28 node.before(node.children).remove63 node.remove_attribute('class')
64 node.add_class('token punctuation')
29 end65 end
30 66
31 # Remove "See Also"67 css('.nf').each do |node|
32 css('.see').each do |node|68 node.remove_attribute('class')
33 node.previous_element.remove69 node.add_class('token function')
34 node.remove
35 end70 end
36 71
37 # Remove "- ([...])" before method names72 css('.o').each do |node|
38 css('.signature', 'span.overload', 'span.signature').each do |node|73 node.remove_attribute('class')
39 next if node.at_css('.overload')74 node.add_class('token operator')
40 node.child.remove while node.child.name != 'strong'
41 end75 end
42 76
43 # Clean up .inline divs77 css('.c1, .cm, .c').each do |node|
44 css('div.inline').each do |node|78 node.remove_attribute('class')
45 node.content = node.content79 node.add_class('token comment')
46 node.name = 'span'
47 end80 end
48 81
49 # Remove links to type classes (e.g. Number)82 css('.mh, .m, .mi').each do |node|
50 css('.type > code').each do |node|83 node.remove_attribute('class')
51 node.before(node.content.remove('Sass::Script::Value::').remove('Sass::Script::')).remove84 node.add_class('token number')
52 end85 end
53 86
54 css('li > span.signature').each do |node|87 css('.nc, .nt').each do |node|
55 node.name = 'p'88 node.remove_attribute('class')
89 node.add_class('token selector')
56 end90 end
57 91
58 css('h3 strong', 'span.overload').each do |node|92 css('.nl').each do |node|
59 node.before(node.children).remove93 node.remove_attribute('class')
94 node.add_class('token property')
60 end95 end
96
97 doc
61 end98 end
62 end99 end
63 end100 end
lib/docs/filters/sass/entries.rb+24−60
@@ -1,89 +1,53 @@
1module Docs1module Docs
2 class Sass2 class Sass
3 class EntriesFilter < Docs::EntriesFilter3 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 def get_name5 def get_name
19 'Functions'6 at_css('#main-content > h1').content
20 end7 end
21 8
22 def get_type9 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 end18 end
25 19
26 def additional_entries20 def additional_entries
27 root_page? ? root_entries : function_entries
28 end
29
30 def root_entries
31 entries = []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 next23 signatureElement = css('.signature')
51 elsif node.name == 'h3' || node.name == 'h4'
52 next unless TYPES.include?(type)
53 24
54 name = node.content.strip25 if signatureElement
55 name.remove! %r{\A.+?: }
56 name.remove! %r{\s#.*}
57 26
58 node['id'] = name.parameterize27 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]31 if entry_name.match(/\(/)
63 name.gsub!(/ [A-Z]/) { |str| str.downcase! }32 entry_name = entry_name.scan(/.+\(/)[0].chop
33 end
64 34
65 if type == '@-Rules and Directives'35 if entry_name.include?('$pi')
66 next unless name =~ /\A@[\w\-]+\z/ || name == '!optional'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 end41 end
68 42
69 entries << [name, node['id'], type]
70 end43 end
44
71 end45 end
72 46
73 entries47 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 end49 end
50
87 end51 end
88 end52 end
89end53end
lib/docs/scrapers/sass.rb+8−8
@@ -1,9 +1,9 @@
1module Docs1module Docs
2 class Sass < UrlScraper2 class Sass < UrlScraper
3 self.type = 'yard'3 self.type = 'yard'
4 self.release = '3.5.3'4 self.release = '3.6.4'
5 self.base_url = 'http://sass-lang.com/documentation/'5 self.base_url = 'https://sass-lang.com/documentation'
6 self.root_path = 'file.SASS_REFERENCE.html'6 self.root_path = 'index.html'
7 self.links = {7 self.links = {
8 home: 'http://sass-lang.com/',8 home: 'http://sass-lang.com/',
9 code: 'https://github.com/sass/sass'9 code: 'https://github.com/sass/sass'
@@ -11,21 +11,21 @@ module Docs · 1 unmodified line
11 11
12 html_filters.push 'sass/clean_html', 'sass/entries', 'title'12 html_filters.push 'sass/clean_html', 'sass/entries', 'title'
13 13
14 options[:only] = %w(Sass/Script/Functions.html)
15 options[:root_title] = false14 options[:root_title] = false
16 options[:title] = 'Sass Functions'15 options[:title] = 'Sass Functions'
17 16
18 options[:container] = ->(filter) do17 options[:skip_patterns] = [/breaking-changes/]
19 filter.root_page? ? '#filecontents' : '#instance_method_details'18
20 end19 # options[:container] = '#main-content'
21 20
22 options[:attribution] = <<-HTML21 options[:attribution] = <<-HTML
23 &copy; 2006&ndash;2016 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein<br>22 &copy; 2006&ndash;2020 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein<br>
24 Licensed under the MIT License.23 Licensed under the MIT License.
25 HTML24 HTML
26 25
27 def get_latest_version(opts)26 def get_latest_version(opts)
28 get_latest_github_release('sass', 'libsass', opts)27 get_latest_github_release('sass', 'libsass', opts)
29 end28 end
29
30 end30 end
31end31end