History

Improve abstract rdoc scraper

Thibaut committed 11 years ago

Commit b58bc8b1 parent ceff86b5 files · +14 −5Browse files

Unified · Split

5 files
  1. assets/stylesheets/pages/_rdoc.scss +1 −1
  2. lib/docs/filters/rdoc/container.rb +3 −1
  3. lib/docs/filters/rdoc/entries.rb +3 −1
  4. lib/docs/scrapers/rdoc/rails.rb +1 −1
  5. lib/docs/scrapers/rdoc/rdoc.rb +6 −1
assets/stylesheets/pages/_rdoc.scss+1−1
@@ -1,6 +1,6 @@
11 ._rdoc {
22 > .description, > .documentation-section { padding-left: 1rem; }
3− > .description > h2, header > h3 { @extend %block-heading; }
3+ > .description > h2, header > h3, > h2 { @extend %block-heading; }
44 > .description > h2, header > h3, .method-heading { margin-left: -1rem; }
55 .description > h1 { font-size: 1rem; }
66 .method-description > h2, h3, h4, h5, h6 { font-size: 1em; }
lib/docs/filters/rdoc/container.rb+3−1
@@ -19,7 +19,9 @@ module Docs · 18 unmodified lines
1919 meta << %(<dt>Included modules:</dt><dd class="meta-includes">#{includes.css('a').map(&:to_html).join(', ')}</dd>)
2020 end
2121
22− container.at_css('h1').after(meta)
22+ if parent || includes
23+ container.at_css('h1').after(meta)
24+ end
2325
2426 container
2527 end
lib/docs/filters/rdoc/entries.rb+3−1
@@ -2,7 +2,9 @@ module Docs · 1 unmodified line
22 class Rdoc
33 class EntriesFilter < Docs::EntriesFilter
44 def get_name
5− name = at_css('h1').content.strip
5+ name = at_css('h1, h2').content.strip
6+ name.remove! "\u{00B6}" # remove pilcrow sign
7+ name.remove! "\u{2191}" # remove up arrow sign
68 name.remove! 'class '
79 name.remove! 'module '
810 name
lib/docs/scrapers/rdoc/rails.rb+1−1
@@ -57,7 +57,7 @@ module Docs · 56 unmodified lines
5757 ActiveSupport/Testing/Isolation/Subprocess.html
5858 Rails/API/Task.html)
5959
60− options[:skip_patterns] = [
60+ options[:skip_patterns] += [
6161 /\AActionController\/Caching(?!\/Fragments|\.)/,
6262 /\AActionController\/RequestForgeryProtection\/ProtectionMethods/,
6363 /\AActionController\/Testing/,
lib/docs/scrapers/rdoc/rdoc.rb+6−1
@@ -5,9 +5,14 @@ module Docs · 4 unmodified lines
55 self.root_path = 'table_of_contents.html'
66
77 html_filters.replace 'container', 'rdoc/container'
8− html_filters.push 'rdoc/entries', 'rdoc/clean_html', 'title'
8+ html_filters.push 'title', 'rdoc/entries', 'rdoc/clean_html'
99
1010 options[:title] = false
1111 options[:skip] = %w(index.html)
12+ options[:skip_patterns] = [
13+ /changelog/i,
14+ /readme/i,
15+ /news/i,
16+ /license/i]
1217 end
1318 end