[devdocsgjs/main: 1308/1867] Update Sass to 3.6.4




commit 2e33ebcd4588e80c00d2c461ea8b90a34d667514
Author: MasterEnoc <brianhernandez222 hotmail com>
Date:   Thu Nov 26 13:50:40 2020 -0600

    Update Sass to 3.6.4

 .../javascripts/templates/pages/about_tmpl.coffee  |   2 +-
 lib/docs/filters/sass/clean_html.rb                | 105 ++++++++++++++-------
 lib/docs/filters/sass/entries.rb                   |  84 +++++------------
 lib/docs/scrapers/sass.rb                          |  16 ++--
 4 files changed, 104 insertions(+), 103 deletions(-)
---
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee 
b/assets/javascripts/templates/pages/about_tmpl.coffee
index 1c287f8c..d3ecc06b 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/assets/javascripts/templates/pages/about_tmpl.coffee
@@ -708,7 +708,7 @@ credits = [
     'https://raw.githubusercontent.com/saltstack/salt/develop/LICENSE'
   ], [
     'Sass',
-    '2006-2016 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein',
+    '2006-2020 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein',
     'MIT',
     'https://raw.githubusercontent.com/sass/sass/stable/MIT-LICENSE'
   ], [
diff --git a/lib/docs/filters/sass/clean_html.rb b/lib/docs/filters/sass/clean_html.rb
index 8c13564c..db5c11ab 100644
--- a/lib/docs/filters/sass/clean_html.rb
+++ b/lib/docs/filters/sass/clean_html.rb
@@ -2,62 +2,99 @@ module Docs
   class Sass
     class CleanHtmlFilter < Filter
       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
 
-        css('pre').each do |node|
-          node.content = node.content
+        # Remove duplicate ids
+        css('.sl-c-callout--function').each do |node|
+           node.remove_attribute('id')
         end
 
-        root_page? ? root : other
+        # Hidden title links
+        css('.visuallyhidden').remove
 
-        doc
-      end
+        ### Syntax Highlight ###
+        css('.kt').each do |node|
+          node.remove_attribute('class')
+          node.add_class('token constant')
+        end
 
-      def root
-        at_css('h1 + ul').remove
-      end
+        css('.k, .kn, .kc, .cp, .ow').each do |node|
+          node.remove_attribute('class')
+          node.add_class('token keyword')
+        end
 
-      def other
-        at_css('h2').remove
+        css('.nv, .no').each do |node|
+          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|
-          node.before(node.children).remove
+        css('.p').each do |node|
+          node.remove_attribute('class')
+          node.add_class('token punctuation')
         end
 
-        # Remove "See Also"
-        css('.see').each do |node|
-          node.previous_element.remove
-          node.remove
+        css('.nf').each do |node|
+          node.remove_attribute('class')
+          node.add_class('token function')
         end
 
-        # Remove "- ([...])" before method names
-        css('.signature', 'span.overload', 'span.signature').each do |node|
-          next if node.at_css('.overload')
-          node.child.remove while node.child.name != 'strong'
+        css('.o').each do |node|
+          node.remove_attribute('class')
+          node.add_class('token operator')
         end
 
-        # Clean up .inline divs
-        css('div.inline').each do |node|
-          node.content = node.content
-          node.name = 'span'
+        css('.c1, .cm, .c').each do |node|
+          node.remove_attribute('class')
+          node.add_class('token comment')
         end
 
-        # Remove links to type classes (e.g. Number)
-        css('.type > code').each do |node|
-          node.before(node.content.remove('Sass::Script::Value::').remove('Sass::Script::')).remove
+        css('.mh, .m, .mi').each do |node|
+          node.remove_attribute('class')
+          node.add_class('token number')
         end
 
-        css('li > span.signature').each do |node|
-          node.name = 'p'
+        css('.nc, .nt').each do |node|
+          node.remove_attribute('class')
+          node.add_class('token selector')
         end
 
-        css('h3 strong', 'span.overload').each do |node|
-          node.before(node.children).remove
+        css('.nl').each do |node|
+          node.remove_attribute('class')
+          node.add_class('token property')
         end
+
+        doc
       end
     end
   end
diff --git a/lib/docs/filters/sass/entries.rb b/lib/docs/filters/sass/entries.rb
index bec811bd..4c97cf61 100644
--- a/lib/docs/filters/sass/entries.rb
+++ b/lib/docs/filters/sass/entries.rb
@@ -1,89 +1,53 @@
 module Docs
   class Sass
     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
-        'Functions'
+        at_css('#main-content > h1').content
       end
 
       def get_type
-        'Functions'
+        return 'Syntax' if slug.include?('syntax')
+        return 'Style rules' if slug.include?('style')
+        return 'At-Rules' if slug.include?('at')
+        return 'Values' if slug.include?('values')
+        return 'Operators' if slug.include?('operators')
+        return 'Command line' if slug.include?('cli')
+        return 'Modules' if slug.include?('modules')
+        'Misc'
       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'
-              entries << ['@function', node['id'], '@-Rules and Directives']
-            end
-
-            if type.include? 'Directives'
-              type = '@-Rules and Directives'
-            elsif type == 'Output Style'
-              type = 'Output Styles'
-            end
 
-            next
-          elsif node.name == 'h3' || node.name == 'h4'
-            next unless TYPES.include?(type)
+        signatureElement = css('.signature')
 
-            name = node.content.strip
-            name.remove! %r{\A.+?: }
-            name.remove! %r{\s#.*}
+        if signatureElement
 
-            node['id'] = name.parameterize
+          signatureElement.each do |node|
 
-            next if SKIP_NAMES.include?(name)
+            entry_name = node.content
 
-            name = REPLACE_NAMES[name] if REPLACE_NAMES[name]
-            name.gsub!(/ [A-Z]/) { |str| str.downcase! }
+            if entry_name.match(/\(/)
+              entry_name = entry_name.scan(/.+\(/)[0].chop
+            end
 
-            if type == '@-Rules and Directives'
-              next unless name =~ /\A@[\w\-]+\z/ || name == '!optional'
+            if entry_name.include?('$pi')
+              entries << [entry_name, 'pi', 'Variable']
+            elsif entry_name.include?('$e')
+              entries << [entry_name, 'e', 'Variable']
+            else
+              entries << [entry_name, entry_name, 'Functions']
             end
 
-            entries << [name, node['id'], type]
           end
+
         end
 
         entries
-      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
-
-          entries
-        end
       end
+
     end
   end
 end
diff --git a/lib/docs/scrapers/sass.rb b/lib/docs/scrapers/sass.rb
index c9774cdf..84b3c47e 100644
--- a/lib/docs/scrapers/sass.rb
+++ b/lib/docs/scrapers/sass.rb
@@ -1,9 +1,9 @@
 module Docs
   class Sass < UrlScraper
     self.type = 'yard'
-    self.release = '3.5.3'
-    self.base_url = 'http://sass-lang.com/documentation/'
-    self.root_path = 'file.SASS_REFERENCE.html'
+    self.release = '3.6.4'
+    self.base_url = 'https://sass-lang.com/documentation'
+    self.root_path = 'index.html'
     self.links = {
       home: 'http://sass-lang.com/',
       code: 'https://github.com/sass/sass'
@@ -11,21 +11,21 @@ module Docs
 
     html_filters.push 'sass/clean_html', 'sass/entries', 'title'
 
-    options[:only] = %w(Sass/Script/Functions.html)
     options[:root_title] = false
     options[:title] = 'Sass Functions'
 
-    options[:container] = ->(filter) do
-      filter.root_page? ? '#filecontents' : '#instance_method_details'
-    end
+    options[:skip_patterns] = [/breaking-changes/]
+
+    # options[:container] = '#main-content'
 
     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.
     HTML
 
     def get_latest_version(opts)
       get_latest_github_release('sass', 'libsass', opts)
     end
+
   end
 end


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]