diff --git a/lib/docs/filters/d3/clean_html.rb b/lib/docs/filters/d3/clean_html.rb index a760b140..7e959bcf 100644 --- a/lib/docs/filters/d3/clean_html.rb +++ b/lib/docs/filters/d3/clean_html.rb @@ -2,6 +2,12 @@ module Docs class D3 class CleanHtmlFilter < Filter def call + # Remove links inside

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

@@ -15,21 +21,6 @@ module Docs node.before(node.at_css('.markdown-body').children).remove end - # Remove links inside

- css('h2 > a').each do |node| - node.before(node.children).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 - # Make headings for function definitions and add "id" attributes css('p > a:first-child').each do |node| next unless node['name'] || node.content == '#' diff --git a/lib/docs/scrapers/d3.rb b/lib/docs/scrapers/d3.rb index 35fca733..ee079caa 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.3' + self.version = '3.4.4' self.base_url = 'https://github.com/mbostock/d3/wiki/' self.root_path = 'API-Reference'