Update RDoc scraper

pull/33/head
Thibaut 11 years ago
parent 7b97af3bdb
commit a9737743cb

@ -1,7 +1,7 @@
._rdoc { ._rdoc {
> .description, > .documentation-section { padding-left: 1rem; } > .description, > .documentation-section { padding-left: 1rem; }
> .description > h2, .section-header { @extend %block-heading; } > .description > h2, header > h3 { @extend %block-heading; }
> .description > h2, .section-header, .method-heading { margin-left: -1rem; } > .description > h2, header > h3, .method-heading { margin-left: -1rem; }
.description > h1 { font-size: 1rem; } .description > h1 { font-size: 1rem; }
.method-description > h2, h3, h4, h5, h6 { font-size: 1em; } .method-description > h2, h3, h4, h5, h6 { font-size: 1em; }

@ -7,7 +7,7 @@ module Docs
end end
def root def root
at_css('.section-header').remove at_css('h3').remove
# Remove skipped items # Remove skipped items
css('li > span').each do |node| css('li > span').each do |node|

@ -5,17 +5,20 @@ module Docs
if root_page? if root_page?
at_css '#classindex-section' at_css '#classindex-section'
else else
container = at_css '#documentation' container = at_css 'main'
# Add <dl> mentioning parent class and included modules # Add <dl> mentioning parent class and included modules
meta = Nokogiri::XML::Node.new 'dl', doc meta = Nokogiri::XML::Node.new 'dl', doc
meta['class'] = 'meta' meta['class'] = 'meta'
if parent = at_css('#parent-class-section') if parent = at_css('#parent-class-section')
meta << %(<dt>Parent:</dt><dd class="meta-parent">#{parent.at_css('.link').inner_html.strip}</dd>) meta << %(<dt>Parent:</dt><dd class="meta-parent">#{parent.at_css('.link').inner_html.strip}</dd>)
end end
if includes = at_css('#includes-section') if includes = at_css('#includes-section')
meta << %(<dt>Included modules:</dt><dd class="meta-includes">#{includes.css('a').map(&:to_html).join(', ')}</dd>) meta << %(<dt>Included modules:</dt><dd class="meta-includes">#{includes.css('a').map(&:to_html).join(', ')}</dd>)
end end
container.at_css('h1').after(meta) container.at_css('h1').after(meta)
container container

@ -20,7 +20,7 @@ module Docs
end end
def include_default_entry? 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 end
def additional_entries def additional_entries

Loading…
Cancel
Save