From a9737743cb6715a2ce9dbaa8ef7718a5dbb57831 Mon Sep 17 00:00:00 2001 From: Thibaut Date: Sun, 5 Jan 2014 17:38:14 -0500 Subject: [PATCH] Update RDoc scraper --- assets/stylesheets/pages/_rdoc.scss | 4 ++-- lib/docs/filters/rdoc/clean_html.rb | 2 +- lib/docs/filters/rdoc/container.rb | 5 ++++- lib/docs/filters/rdoc/entries.rb | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/assets/stylesheets/pages/_rdoc.scss b/assets/stylesheets/pages/_rdoc.scss index 8f9ebde4..feac3447 100644 --- a/assets/stylesheets/pages/_rdoc.scss +++ b/assets/stylesheets/pages/_rdoc.scss @@ -1,7 +1,7 @@ ._rdoc { > .description, > .documentation-section { padding-left: 1rem; } - > .description > h2, .section-header { @extend %block-heading; } - > .description > h2, .section-header, .method-heading { margin-left: -1rem; } + > .description > h2, header > h3 { @extend %block-heading; } + > .description > h2, header > h3, .method-heading { margin-left: -1rem; } .description > h1 { font-size: 1rem; } .method-description > h2, h3, h4, h5, h6 { font-size: 1em; } diff --git a/lib/docs/filters/rdoc/clean_html.rb b/lib/docs/filters/rdoc/clean_html.rb index f5d15f64..eaf32927 100644 --- a/lib/docs/filters/rdoc/clean_html.rb +++ b/lib/docs/filters/rdoc/clean_html.rb @@ -7,7 +7,7 @@ module Docs end def root - at_css('.section-header').remove + at_css('h3').remove # Remove skipped items css('li > span').each do |node| diff --git a/lib/docs/filters/rdoc/container.rb b/lib/docs/filters/rdoc/container.rb index 770ffdde..7a126de8 100644 --- a/lib/docs/filters/rdoc/container.rb +++ b/lib/docs/filters/rdoc/container.rb @@ -5,17 +5,20 @@ module Docs if root_page? at_css '#classindex-section' else - container = at_css '#documentation' + container = at_css 'main' # Add
mentioning parent class and included modules meta = Nokogiri::XML::Node.new 'dl', doc meta['class'] = 'meta' + if parent = at_css('#parent-class-section') meta << %(
Parent:
#{parent.at_css('.link').inner_html.strip}
) end + if includes = at_css('#includes-section') meta << %(
Included modules:
#{includes.css('a').map(&:to_html).join(', ')}
) end + container.at_css('h1').after(meta) container diff --git a/lib/docs/filters/rdoc/entries.rb b/lib/docs/filters/rdoc/entries.rb index e882b2a9..8aa8fd66 100644 --- a/lib/docs/filters/rdoc/entries.rb +++ b/lib/docs/filters/rdoc/entries.rb @@ -20,7 +20,7 @@ module Docs end def include_default_entry? - at_css('#description p') || css('.documentation-section').any? { |node| node.content.present? } + at_css('> .description p') || css('.documentation-section').any? { |node| node.content.present? } end def additional_entries