Extend Github scraper

pull/852/head
Jasper van Merle 7 years ago
parent b1f2ec1267
commit 7e77f98ae0

@ -39,7 +39,6 @@
._mocha, ._mocha,
._mongoose, ._mongoose,
._nim, ._nim,
._puppeteer,
._redux, ._redux,
._requirejs, ._requirejs,
._simple, ._simple,

@ -15,14 +15,6 @@ module Docs
css('h3').each {|node| node.name = 'h2'} css('h3').each {|node| node.name = 'h2'}
css('h4').each {|node| node.name = 'h3'} css('h4').each {|node| node.name = 'h3'}
css('pre').each do |node|
# Remove nested tags
node.content = node.content
# Add syntax highlighting
node['data-language'] = 'js'
end
doc doc
end end
end end

@ -9,10 +9,6 @@ module Docs
css('h3').each do |node| css('h3').each do |node|
name = node.content.split(': ').last name = node.content.split(': ').last
# Set the id to the id of the link in the header
# Also remove the "user-content-" part of the id to fix internal links
node['id'] = node.at_css('a')['id'].sub('user-content-', '')
# Find all sub-items (all h4's between the current h3 and the next) # Find all sub-items (all h4's between the current h3 and the next)
current = node.next current = node.next
while !current.nil? && current.name != 'h3' while !current.nil? && current.name != 'h3'
@ -29,8 +25,6 @@ module Docs
current_name = current_name.split('(')[0] + '()' current_name = current_name.split('(')[0] + '()'
end end
current['id'] = current.at_css('a')['id'].sub('user-content-', '')
entries << [current_name, current['id'], name] entries << [current_name, current['id'], name]
end end

@ -1,6 +1,5 @@
module Docs module Docs
class Puppeteer < UrlScraper class Puppeteer < Github
self.type = 'puppeteer'
self.release = '1.6.2' self.release = '1.6.2'
self.base_url = 'https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md' self.base_url = 'https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md'
self.links = { self.links = {

Loading…
Cancel
Save