浏览代码

Update Sass documentation (3.3.0)

Thibaut 11 年之前
父节点
当前提交
2f17c05b31

+ 1 - 1
assets/javascripts/templates/pages/about_tmpl.coffee

@@ -192,7 +192,7 @@ credits = [
     'https://raw.github.com/rails/rails/master/activerecord/MIT-LICENSE'
   ], [
     'Sass',
-    '2006-2013 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein',
+    '2006-2014 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein',
     'MIT',
     'https://raw.github.com/nex3/sass/master/MIT-LICENSE'
   ], [

+ 2 - 0
assets/stylesheets/pages/_yard.scss

@@ -11,4 +11,6 @@
     h3 { font-size: inherit; }
     ul, pre { margin: 1em 0; }
   }
+
+  .tag_title { font-weight: bold; }
 }

+ 14 - 9
lib/docs/filters/sass/clean_html.rb

@@ -20,26 +20,31 @@ module Docs
 
         css('.showSource', '.source_code').remove
 
+        css('div.docstring', 'div.discussion').each do |node|
+          node.before(node.children).remove
+        end
+
         # Remove "See Also"
         css('.see').each do |node|
           node.previous_element.remove
           node.remove
         end
 
-        # Un-indent code blocks
-        css('pre.example').each do |node|
-          node.inner_html = node.inner_html.strip_heredoc
+        # 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'
         end
 
-        # Remove "- " before method names
-        css('.signature', 'span.overload').each do |node|
-          node.child.content = node.child.content.sub(/\A\s*-\s*/, '')
+        # Clean up .inline divs
+        css('div.inline').each do |node|
+          node.content = node.content
+          node.name = 'span'
         end
 
         # Remove links to type classes (e.g. Number)
-        css('.type > code > a, .signature > code > a, span.overload > code > a').each do |node|
-          node.before(node.content)
-          node.remove
+        css('.type > code').each do |node|
+          node.before(node.content.sub('Sass::Script::Value::', '').sub('Sass::Script::', '')).remove
         end
       end
     end

+ 3 - 3
lib/docs/filters/sass/entries.rb

@@ -11,7 +11,7 @@ module Docs
         '%foo'               => '%placeholder selector',
         '&'                  => '& parent selector',
         '$'                  => '$ variables',
-        '#{}'                => '#{} interpolation',
+        '`'                  => '#{} interpolation',
         'The !optional Flag' => '!optional'
       }
 
@@ -35,7 +35,7 @@ module Docs
               entries << ['@function', node['id'], '@-Rules and Directives']
             end
 
-            if type.end_with? 'Directives'
+            if type.include? 'Directives'
               type = '@-Rules and Directives'
             elsif type == 'Output Style'
               type = 'Output Styles'
@@ -55,7 +55,7 @@ module Docs
           name.gsub!(/ [A-Z]/) { |str| str.downcase! }
 
           if type == '@-Rules and Directives'
-            next unless name =~ /\A@\w+\z/ || name == '!optional'
+            next unless name =~ /\A@[\w\-]+\z/ || name == '!optional'
           end
 
           entries << [name, node['id'], type]

+ 5 - 7
lib/docs/scrapers/sass.rb

@@ -1,24 +1,22 @@
 module Docs
   class Sass < UrlScraper
     self.type = 'yard'
-    self.version = '3.2.12'
-    self.base_url = 'http://sass-lang.com/docs/yardoc/'
+    self.version = '3.3.0'
+    self.base_url = 'http://sass-lang.com/documentation/'
     self.root_path = 'file.SASS_REFERENCE.html'
 
     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[:title] = ->(filter) do
-      'Sass Functions' if filter.slug == 'Sass/Script/Functions'
-    end
-
     options[:attribution] = <<-HTML
-      &copy; 2006&ndash;2013 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein<br>
+      &copy; 2006&ndash;2014 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein<br>
       Licensed under the MIT License.
     HTML
   end