| @@ -4,15 +4,15 @@ module Docs · 3 unmodified lines |
| 4 | def call | 4 | def call |
| 5 | # Remove links inside <h2> and add "id" attributes | 5 | # Remove links inside <h2> and add "id" attributes |
| 6 | css('h2 > a').each do |node| | 6 | css('h2 > a').each do |node| |
| 7 | node.parent['id'] = node['name'].remove('wiki-') if node['name'] | 7 | node.parent['id'] = node['name'].remove('user-content-') if node['name'] |
| 8 | node.before(node.children).remove | 8 | node.before(node.children).remove |
| 9 | end | 9 | end |
| 10 | | 10 | |
| 11 | css('#gollum-footer', '.markdown-body > blockquote:first-child', '.anchor').remove | 11 | css('.markdown-body > blockquote:first-child', '.anchor').remove |
| 12 | | 12 | |
| 13 | # Replace #head with <h1> | 13 | # Replace .gh-header with <h1> |
| 14 | css('#head > h1').each do |node| | 14 | css('.gh-header-title').each do |node| |
| 15 | node.parent.before(node).remove | 15 | node.parent.parent.before(node).remove |
| 16 | node.content = 'D3.js' if root_page? | 16 | node.content = 'D3.js' if root_page? |
| 17 | end | 17 | end |
| 18 | | 18 | |
| @@ -26,14 +26,14 @@ module Docs · 7 unmodified lines |
| 26 | next unless node['name'] || node.content == '#' | 26 | next unless node['name'] || node.content == '#' |
| 27 | parent = node.parent | 27 | parent = node.parent |
| 28 | parent.name = 'h6' | 28 | parent.name = 'h6' |
| 29 | parent['id'] = (node['name'] || node['href'].remove(/\A.+#/)).remove('wiki-') | 29 | parent['id'] = (node['name'] || node['href'].remove(/\A.+#/)).remove('user-content-') |
| 30 | parent.css('a[name]').remove | 30 | parent.css('a[name]').remove |
| 31 | node.remove | 31 | node.remove |
| 32 | end | 32 | end |
| 33 | | 33 | |
| 34 | # Fix internal links | 34 | # Fix internal links |
| 35 | css('a[href]').each do |node| | 35 | css('a[href]').each do |node| |
| 36 | node['href'] = node['href'].sub(/#wiki\-(\w+?)\z/, '#\1') | 36 | node['href'] = node['href'].sub(/#user\-content\-(\w+?)\z/, '#\1').sub(/#wiki\-(\w+?)\z/, '#\1') |
| 37 | end | 37 | end |
| 38 | | 38 | |
| 39 | # Remove code highlighting | 39 | # Remove code highlighting |