History

Fix issues in Angular scraper

Thibaut Courouble committed 10 years ago

Commit f0211021 parent 8b72bd53 files · +11 −5Browse files

Unified · Split

3 files
  1. lib/docs/filters/angular/clean_html.rb +7 −0
  2. lib/docs/filters/angular/entries.rb +4 −4
  3. lib/docs/scrapers/angular.rb +0 −1
lib/docs/filters/angular/clean_html.rb+7−0
@@ -12,6 +12,13 @@ module Docs · 11 unmodified lines
1212 container.child.before(at_css('header.hero h1')).before(badges).before(css('header.hero + .banner'))
1313 @doc = container
1414
15+ title = at_css('h1').content.strip
16+ if title == 'Index'
17+ at_css('h1').content = result[:entries].first.name
18+ elsif title == 'Angular'
19+ at_css('h1').content = slug.split('/').last.gsub('-', ' ')
20+ end
21+
1522 css('pre.no-bg-with-indent').each do |node|
1623 node.content = ' ' + node.content.gsub("\n", "\n ")
1724 end
lib/docs/filters/angular/entries.rb+4−4
@@ -11,10 +11,10 @@ module Docs · 10 unmodified lines
1111 name = name.split(':').first
1212
1313 if mod
14− if name == 'Testing'
15− return "#{mod.capitalize} Testing"
16− elsif name == 'Index' || name == 'Angular'
17− return mod
14+ if name == 'Index'
15+ return slug.split('/')[1..-2].join('/')
16+ elsif name == 'Angular'
17+ return slug.split('/').last.split('-').first
1818 end
1919 end
2020
lib/docs/scrapers/angular.rb+0−1
@@ -25,7 +25,6 @@ module Docs · 24 unmodified lines
2525
2626 options[:fix_urls] = -> (url) do
2727 url.sub! %r{\A(https://angular\.io/docs/.+/)index\.html\z}, '\1'
28− url.sub! %r{\A(https://angular\.io/docs/.+/index)/\z}, '\1'
2928 url
3029 end
3130

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t