From 2f17c05b31b214c74b9998632ec1870ef11966d3 Mon Sep 17 00:00:00 2001 From: Thibaut Date: Sun, 9 Mar 2014 10:20:53 -0400 Subject: [PATCH] Update Sass documentation (3.3.0) --- .../templates/pages/about_tmpl.coffee | 2 +- assets/stylesheets/pages/_yard.scss | 2 ++ lib/docs/filters/sass/clean_html.rb | 23 +++++++++++-------- lib/docs/filters/sass/entries.rb | 6 ++--- lib/docs/scrapers/sass.rb | 12 ++++------ 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 06475cff..9f6ea9e3 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/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' ], [ diff --git a/assets/stylesheets/pages/_yard.scss b/assets/stylesheets/pages/_yard.scss index 6571ede7..8df2a22e 100644 --- a/assets/stylesheets/pages/_yard.scss +++ b/assets/stylesheets/pages/_yard.scss @@ -11,4 +11,6 @@ h3 { font-size: inherit; } ul, pre { margin: 1em 0; } } + + .tag_title { font-weight: bold; } } diff --git a/lib/docs/filters/sass/clean_html.rb b/lib/docs/filters/sass/clean_html.rb index b3c48d07..f9c0f46c 100644 --- a/lib/docs/filters/sass/clean_html.rb +++ b/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 diff --git a/lib/docs/filters/sass/entries.rb b/lib/docs/filters/sass/entries.rb index abfb8284..ae466e34 100644 --- a/lib/docs/filters/sass/entries.rb +++ b/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] diff --git a/lib/docs/scrapers/sass.rb b/lib/docs/scrapers/sass.rb index d60f5b04..b96da451 100644 --- a/lib/docs/scrapers/sass.rb +++ b/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 - © 2006–2013 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein
+ © 2006–2014 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein
Licensed under the MIT License. HTML end