diff --git a/lib/docs/filters/d3/clean_html.rb b/lib/docs/filters/d3/clean_html.rb index 783cca7b..80bb69e8 100644 --- a/lib/docs/filters/d3/clean_html.rb +++ b/lib/docs/filters/d3/clean_html.rb @@ -4,15 +4,15 @@ module Docs def call # Remove links inside

and add "id" attributes css('h2 > a').each do |node| - node.parent['id'] = node['name'].remove('wiki-') if node['name'] + node.parent['id'] = node['name'].remove('user-content-') if node['name'] node.before(node.children).remove end - css('#gollum-footer', '.markdown-body > blockquote:first-child', '.anchor').remove + css('.markdown-body > blockquote:first-child', '.anchor').remove - # Replace #head with

- css('#head > h1').each do |node| - node.parent.before(node).remove + # Replace .gh-header with

+ css('.gh-header-title').each do |node| + node.parent.parent.before(node).remove node.content = 'D3.js' if root_page? end @@ -26,14 +26,14 @@ module Docs next unless node['name'] || node.content == '#' parent = node.parent parent.name = 'h6' - parent['id'] = (node['name'] || node['href'].remove(/\A.+#/)).remove('wiki-') + parent['id'] = (node['name'] || node['href'].remove(/\A.+#/)).remove('user-content-') 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') + node['href'] = node['href'].sub(/#user\-content\-(\w+?)\z/, '#\1').sub(/#wiki\-(\w+?)\z/, '#\1') end # Remove code highlighting diff --git a/lib/docs/filters/d3/entries.rb b/lib/docs/filters/d3/entries.rb index 34fc3323..7f19c97d 100644 --- a/lib/docs/filters/d3/entries.rb +++ b/lib/docs/filters/d3/entries.rb @@ -11,8 +11,9 @@ module Docs def additional_entries css('h6[id]').inject [] do |entries, node| - name = node.content + name = node.content.strip name.remove! %r{\(.*\z} + name.sub! %r{\A(svg:\w+)\s+.+}, '\1' entries << [name, node['id']] unless name == entries.last.try(:first) entries end diff --git a/lib/docs/scrapers/d3.rb b/lib/docs/scrapers/d3.rb index dab22e64..7a440baa 100644 --- a/lib/docs/scrapers/d3.rb +++ b/lib/docs/scrapers/d3.rb @@ -3,7 +3,7 @@ module Docs self.name = 'D3.js' self.slug = 'd3' self.type = 'd3' - self.version = '3.4.6' + self.version = '3.4.8' self.base_url = 'https://github.com/mbostock/d3/wiki/' self.root_path = 'API-Reference'