Fix issues in Angular scraper

pull/513/head
Thibaut Courouble 8 years ago
parent 8b72bd5796
commit f0211029ef

@ -12,6 +12,13 @@ module Docs
container.child.before(at_css('header.hero h1')).before(badges).before(css('header.hero + .banner')) container.child.before(at_css('header.hero h1')).before(badges).before(css('header.hero + .banner'))
@doc = container @doc = container
title = at_css('h1').content.strip
if title == 'Index'
at_css('h1').content = result[:entries].first.name
elsif title == 'Angular'
at_css('h1').content = slug.split('/').last.gsub('-', ' ')
end
css('pre.no-bg-with-indent').each do |node| css('pre.no-bg-with-indent').each do |node|
node.content = ' ' + node.content.gsub("\n", "\n ") node.content = ' ' + node.content.gsub("\n", "\n ")
end end

@ -11,10 +11,10 @@ module Docs
name = name.split(':').first name = name.split(':').first
if mod if mod
if name == 'Testing' if name == 'Index'
return "#{mod.capitalize} Testing" return slug.split('/')[1..-2].join('/')
elsif name == 'Index' || name == 'Angular' elsif name == 'Angular'
return mod return slug.split('/').last.split('-').first
end end
end end

@ -25,7 +25,6 @@ module Docs
options[:fix_urls] = -> (url) do options[:fix_urls] = -> (url) do
url.sub! %r{\A(https://angular\.io/docs/.+/)index\.html\z}, '\1' url.sub! %r{\A(https://angular\.io/docs/.+/)index\.html\z}, '\1'
url.sub! %r{\A(https://angular\.io/docs/.+/index)/\z}, '\1'
url url
end end

Loading…
Cancel
Save