Merge pull request #1388 from MasterEnoc/sass

Update Sass to 3.6.4
pull/1392/head
Simon Legner 4 years ago committed by GitHub
commit bf8c8fe53d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -708,7 +708,7 @@ credits = [
'https://raw.githubusercontent.com/saltstack/salt/develop/LICENSE' 'https://raw.githubusercontent.com/saltstack/salt/develop/LICENSE'
], [ ], [
'Sass', 'Sass',
'2006-2016 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein', '2006-2020 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein',
'MIT', 'MIT',
'https://raw.githubusercontent.com/sass/sass/stable/MIT-LICENSE' 'https://raw.githubusercontent.com/sass/sass/stable/MIT-LICENSE'
], [ ], [

@ -2,62 +2,99 @@ module Docs
class Sass class Sass
class CleanHtmlFilter < Filter class CleanHtmlFilter < Filter
def call def call
css('tt').each do |node|
node.name = 'code' css('.sl-c-alert').remove
css('.sl-l-medium-holy-grail__navigation').remove
css('.sl-r-banner').remove
css('.site-footer').remove
# Add id to code blocks
css('pre.signature').each do |node|
id = node.content
if id.match(/\(/)
id = id.scan(/.+\(/)[0].chop
end
if id.include?('$pi')
node.set_attribute('id', 'pi')
elsif id.include?('$e')
node.set_attribute('id', 'e')
else
node.set_attribute('id', id)
end
end end
css('pre').each do |node| # Remove duplicate ids
node.content = node.content css('.sl-c-callout--function').each do |node|
node.remove_attribute('id')
end end
root_page? ? root : other # Hidden title links
css('.visuallyhidden').remove
doc ### Syntax Highlight ###
css('.kt').each do |node|
node.remove_attribute('class')
node.add_class('token constant')
end end
def root css('.k, .kn, .kc, .cp, .ow').each do |node|
at_css('h1 + ul').remove node.remove_attribute('class')
node.add_class('token keyword')
end end
def other css('.nv, .no').each do |node|
at_css('h2').remove node.remove_attribute('class')
node.add_class('token variable')
end
css('.showSource', '.source_code').remove css('.nb, .n').each do |node|
node.remove_attribute('class')
node.add_class('token string')
end
css('div.docstring', 'div.discussion').each do |node| css('.p').each do |node|
node.before(node.children).remove node.remove_attribute('class')
node.add_class('token punctuation')
end end
# Remove "See Also" css('.nf').each do |node|
css('.see').each do |node| node.remove_attribute('class')
node.previous_element.remove node.add_class('token function')
node.remove
end end
# Remove "- ([...])" before method names css('.o').each do |node|
css('.signature', 'span.overload', 'span.signature').each do |node| node.remove_attribute('class')
next if node.at_css('.overload') node.add_class('token operator')
node.child.remove while node.child.name != 'strong'
end end
# Clean up .inline divs css('.c1, .cm, .c').each do |node|
css('div.inline').each do |node| node.remove_attribute('class')
node.content = node.content node.add_class('token comment')
node.name = 'span'
end end
# Remove links to type classes (e.g. Number) css('.mh, .m, .mi').each do |node|
css('.type > code').each do |node| node.remove_attribute('class')
node.before(node.content.remove('Sass::Script::Value::').remove('Sass::Script::')).remove node.add_class('token number')
end end
css('li > span.signature').each do |node| css('.nc, .nt').each do |node|
node.name = 'p' node.remove_attribute('class')
node.add_class('token selector')
end end
css('h3 strong', 'span.overload').each do |node| css('.nl').each do |node|
node.before(node.children).remove node.remove_attribute('class')
node.add_class('token property')
end end
doc
end end
end end
end end

@ -1,89 +1,65 @@
module Docs module Docs
class Sass class Sass
class EntriesFilter < Docs::EntriesFilter class EntriesFilter < Docs::EntriesFilter
TYPES = ['CSS Extensions', 'SassScript', '@-Rules and Directives',
'Output Styles']
SKIP_NAMES = ['Interactive Shell', 'Data Types', 'Operations',
'Division and /', 'Keyword Arguments']
REPLACE_NAMES = {
'%foo' => '%placeholder selector',
'&' => '& parent selector',
'$' => '$ variables',
'`' => '#{} interpolation',
'The !optional Flag' => '!optional'
}
def get_name def get_name
'Functions' at_css('#main-content > h1').content
end end
def get_type def get_type
'Functions'
end
def additional_entries
root_page? ? root_entries : function_entries
end
def root_entries
entries = []
type = ''
css('*').each do |node|
if node.name == 'h2'
type = node.content.strip
type.remove! %r{\s#.*}
node['id'] = type.parameterize
if type == 'Function Directives' case slug
entries << ['@function', node['id'], '@-Rules and Directives'] when /syntax/
'Syntax'
when /style/
'Style rules'
when /at/
'At-Rules'
when /values/
'Values'
when /operators/
'Operators'
when /cli/
'Command line'
when /modules/
'Modules'
else
'Misc'
end end
if type.include? 'Directives'
type = '@-Rules and Directives'
elsif type == 'Output Style'
type = 'Output Styles'
end end
next def additional_entries
elsif node.name == 'h3' || node.name == 'h4' entries = []
next unless TYPES.include?(type)
name = node.content.strip signatureElement = css('.signature')
name.remove! %r{\A.+?: }
name.remove! %r{\s#.*}
node['id'] = name.parameterize if signatureElement
next if SKIP_NAMES.include?(name) signatureElement.each do |node|
name = REPLACE_NAMES[name] if REPLACE_NAMES[name] entry_name = node.content
name.gsub!(/ [A-Z]/) { |str| str.downcase! }
if type == '@-Rules and Directives' if entry_name.match(/\(/)
next unless name =~ /\A@[\w\-]+\z/ || name == '!optional' entry_name = entry_name.scan(/.+\(/)[0].chop
end end
entries << [name, node['id'], type] if entry_name.include?('$pi')
end entries << [entry_name, 'pi', 'Variable']
elsif entry_name.include?('$e')
entries << [entry_name, 'e', 'Variable']
else
entries << [entry_name, entry_name, 'Functions']
end end
entries
end end
def function_entries
css('.method_details > .signature').inject [] do |entries, node|
name = node.content.strip.remove(%r{\(.*})
unless name == entries.last.try(:first)
entries << [name, node['id'], 'Functions']
end end
entries entries
end end
end
end end
end end
end end

@ -1,9 +1,9 @@
module Docs module Docs
class Sass < UrlScraper class Sass < UrlScraper
self.type = 'yard' self.type = 'yard'
self.release = '3.5.3' self.release = '3.6.4'
self.base_url = 'http://sass-lang.com/documentation/' self.base_url = 'https://sass-lang.com/documentation'
self.root_path = 'file.SASS_REFERENCE.html' self.root_path = 'index.html'
self.links = { self.links = {
home: 'http://sass-lang.com/', home: 'http://sass-lang.com/',
code: 'https://github.com/sass/sass' code: 'https://github.com/sass/sass'
@ -11,21 +11,21 @@ module Docs
html_filters.push 'sass/clean_html', 'sass/entries', 'title' html_filters.push 'sass/clean_html', 'sass/entries', 'title'
options[:only] = %w(Sass/Script/Functions.html)
options[:root_title] = false options[:root_title] = false
options[:title] = 'Sass Functions' options[:title] = 'Sass Functions'
options[:container] = ->(filter) do options[:skip_patterns] = [/breaking-changes/]
filter.root_page? ? '#filecontents' : '#instance_method_details'
end # options[:container] = '#main-content'
options[:attribution] = <<-HTML options[:attribution] = <<-HTML
&copy; 2006&ndash;2016 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein<br> &copy; 2006&ndash;2020 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein<br>
Licensed under the MIT License. Licensed under the MIT License.
HTML HTML
def get_latest_version(opts) def get_latest_version(opts)
get_latest_github_release('sass', 'libsass', opts) get_latest_github_release('sass', 'libsass', opts)
end end
end end
end end

Loading…
Cancel
Save