Improve D3.js scraper (3.4.3)

pull/67/merge
Thibaut 11 years ago
parent 6186cb53e1
commit ecdc9c8431

@ -30,6 +30,21 @@ module Docs
node.remove
end
# Make headings for function definitions and add "id" attributes
css('p > a:first-child').each do |node|
next unless node['name'] || node.content == '#'
parent = node.parent
parent.name = 'h6'
parent['id'] = (node['name'] || node['href'].sub(/\A.+#/, '')).sub('wiki-', '')
parent.css('a[name]').remove
node.remove
end
# Fix internal links
css('a[href]').each do |node|
node['href'] = node['href'].sub(/#wiki\-(\w+?)\z/, '#\1')
end
# Remove code highlighting
css('.highlight > pre').each do |node|
node.content = node.content

@ -3,7 +3,7 @@ module Docs
self.name = 'D3.js'
self.slug = 'd3'
self.type = 'd3'
self.version = '3.4.2'
self.version = '3.4.3'
self.base_url = 'https://github.com/mbostock/d3/wiki/'
self.root_path = 'API-Reference'

Loading…
Cancel
Save