History

Improve Ruby/RDoc scraper

Thibaut committed 12 years ago

Commit 1eed7c71 parent 706270d4 files · +11 −7Browse files

Unified · Split

4 files
  1. assets/stylesheets/pages/_rdoc.scss +1 −1
  2. lib/docs/filters/rdoc/clean_html.rb +1 −1
  3. lib/docs/filters/rdoc/entries.rb +9 −2
  4. lib/docs/scrapers/rdoc/ruby.rb +0 −3
assets/stylesheets/pages/_rdoc.scss+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
33 > .description > h2, .section-header { @extend %block-heading; }
44 > .description > h2, .section-header, .method-heading { margin-left: -1rem; }
55 .description > h1 { font-size: 1rem; }
6− .method-description > h2, h3, h4 { font-size: 1em; }
6+ .method-description > h2, h3, h4, h5, h6 { font-size: 1em; }
77
88 .method-heading {
99 font-weight: bold;
lib/docs/filters/rdoc/clean_html.rb+1−1
@@ -19,7 +19,7 @@ module Docs · 18 unmodified lines
1919 css('hr').remove
2020
2121 # Remove paragraph/up links
22− css('h1 > span', 'h2 > span', 'h3 > span', 'h4 > span').remove
22+ css('h1 > span', 'h2 > span', 'h3 > span', 'h4 > span', 'h5 > span', 'h6 > span').remove
2323
2424 # Move id attributes to headings
2525 css('.method-detail').each do |node|
lib/docs/filters/rdoc/entries.rb+9−2
@@ -19,6 +19,10 @@ module Docs · 18 unmodified lines
1919 type
2020 end
2121
22+ def include_default_entry?
23+ at_css('#description p') || css('.documentation-section').any? { |node| node.content.present? }
24+ end
25+
2226 def additional_entries
2327 return [] if root_page?
2428 require 'cgi'
@@ -29,9 +33,12 @@ module Docs · 4 unmodified lines
2933 name.sub! %r{\A-(?!\d)}, ''
3034 name.gsub! '-', '%'
3135 name = CGI.unescape(name)
32− name.prepend self.name + (node['id'] =~ /\A\w+-c-/ ? '::' : '#')
3336
34− entries << [name, node['id']] unless entries.any? { |entry| entry[0] == name }
37+ unless name.start_with? '_'
38+ name.prepend self.name + (node['id'] =~ /\A\w+-c-/ ? '::' : '#')
39+ entries << [name, node['id']] unless entries.any? { |entry| entry[0] == name }
40+ end
41+
3542 entries
3643 end
3744 end
lib/docs/scrapers/rdoc/ruby.rb+0−3
@@ -29,15 +29,12 @@ module Docs · 28 unmodified lines
2929
3030 options[:skip] += %w(
3131 fatal.html
32− unknown.html
3332 CompositePublisher.html
3433 Data.html
3534 E2MM.html
3635 English.html
3736 Exception2MessageMapper.html
38− EXCEPTION_TYPE.html
3937 GServer.html
40− Logging.html
4138 MakeMakefile.html
4239 ParallelEach.html
4340 Requirement.html