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 @@
1._rdoc {1._rdoc {
2 > .description, > .documentation-section { padding-left: 1rem; }2 > .description, > .documentation-section { padding-left: 1rem; }
3 > .description > h2, header > h3 { @extend %block-heading; }3 > .description > h2, header > h3, > h2 { @extend %block-heading; }
4 > .description > h2, header > h3, .method-heading { margin-left: -1rem; }4 > .description > h2, header > h3, .method-heading { margin-left: -1rem; }
5 .description > h1 { font-size: 1rem; }5 .description > h1 { font-size: 1rem; }
6 .method-description > h2, h3, h4, h5, h6 { font-size: 1em; }6 .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
19 meta << %(<dt>Included modules:</dt><dd class="meta-includes">#{includes.css('a').map(&:to_html).join(', ')}</dd>)19 meta << %(<dt>Included modules:</dt><dd class="meta-includes">#{includes.css('a').map(&:to_html).join(', ')}</dd>)
20 end20 end
21 21
22 container.at_css('h1').after(meta)22 if parent || includes
23 container.at_css('h1').after(meta)
24 end
23 25
24 container26 container
25 end27 end
lib/docs/filters/rdoc/entries.rb+3−1
@@ -2,7 +2,9 @@ module Docs · 1 unmodified line
2 class Rdoc2 class Rdoc
3 class EntriesFilter < Docs::EntriesFilter3 class EntriesFilter < Docs::EntriesFilter
4 def get_name4 def get_name
5 name = at_css('h1').content.strip5 name = at_css('h1, h2').content.strip
6 name.remove! "\u{00B6}" # remove pilcrow sign
7 name.remove! "\u{2191}" # remove up arrow sign
6 name.remove! 'class '8 name.remove! 'class '
7 name.remove! 'module '9 name.remove! 'module '
8 name10 name
lib/docs/scrapers/rdoc/rails.rb+1−1
@@ -57,7 +57,7 @@ module Docs · 56 unmodified lines
57 ActiveSupport/Testing/Isolation/Subprocess.html57 ActiveSupport/Testing/Isolation/Subprocess.html
58 Rails/API/Task.html)58 Rails/API/Task.html)
59 59
60 options[:skip_patterns] = [60 options[:skip_patterns] += [
61 /\AActionController\/Caching(?!\/Fragments|\.)/,61 /\AActionController\/Caching(?!\/Fragments|\.)/,
62 /\AActionController\/RequestForgeryProtection\/ProtectionMethods/,62 /\AActionController\/RequestForgeryProtection\/ProtectionMethods/,
63 /\AActionController\/Testing/,63 /\AActionController\/Testing/,
lib/docs/scrapers/rdoc/rdoc.rb+6−1
@@ -5,9 +5,14 @@ module Docs · 4 unmodified lines
5 self.root_path = 'table_of_contents.html'5 self.root_path = 'table_of_contents.html'
6 6
7 html_filters.replace 'container', 'rdoc/container'7 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'
9 9
10 options[:title] = false10 options[:title] = false
11 options[:skip] = %w(index.html)11 options[:skip] = %w(index.html)
12 options[:skip_patterns] = [
13 /changelog/i,
14 /readme/i,
15 /news/i,
16 /license/i]
12 end17 end
13end18end