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
12 container.child.before(at_css('header.hero h1')).before(badges).before(css('header.hero + .banner'))12 container.child.before(at_css('header.hero h1')).before(badges).before(css('header.hero + .banner'))
13 @doc = container13 @doc = container
14 14
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
15 css('pre.no-bg-with-indent').each do |node|22 css('pre.no-bg-with-indent').each do |node|
16 node.content = ' ' + node.content.gsub("\n", "\n ")23 node.content = ' ' + node.content.gsub("\n", "\n ")
17 end24 end
lib/docs/filters/angular/entries.rb+4−4
@@ -11,10 +11,10 @@ module Docs · 10 unmodified lines
11 name = name.split(':').first11 name = name.split(':').first
12 12
13 if mod13 if mod
14 if name == 'Testing'14 if name == 'Index'
15 return "#{mod.capitalize} Testing"15 return slug.split('/')[1..-2].join('/')
16 elsif name == 'Index' || name == 'Angular'16 elsif name == 'Angular'
17 return mod17 return slug.split('/').last.split('-').first
18 end18 end
19 end19 end
20 20
lib/docs/scrapers/angular.rb+0−1
@@ -25,7 +25,6 @@ module Docs · 24 unmodified lines
25 25
26 options[:fix_urls] = -> (url) do26 options[:fix_urls] = -> (url) do
27 url.sub! %r{\A(https://angular\.io/docs/.+/)index\.html\z}, '\1'27 url.sub! %r{\A(https://angular\.io/docs/.+/)index\.html\z}, '\1'
28 url.sub! %r{\A(https://angular\.io/docs/.+/index)/\z}, '\1'
29 url28 url
30 end29 end
31 30

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