Fixes #236
Unified · Split
| @@ -2,17 +2,12 @@ module Docs · 1 unmodified line | |||
| 2 | class Cordova | 2 | class Cordova |
| 3 | class CleanHtmlFilter < Filter | 3 | class CleanHtmlFilter < Filter |
| 4 | def call | 4 | def call |
| 5 | if root_page? || slug == 'cordova_events_events.md' | ||
| 6 | css('h1, h2').each do |node| | ||
| 7 | node.name = node.name.sub(/\d/) { |i| i.to_i + 1 } | ||
| 8 | end | ||
| 9 | at_css('h2').name = 'h1' if slug == 'cordova_events_events.md' | ||
| 10 | end | ||
| 11 | |||
| 12 | if root_page? | 5 | if root_page? |
| 13 | css('li > h3').each do |node| | 6 | css('h1').each { |node| node.name = 'h2' } |
| 14 | node.name = 'div' | 7 | css('li > h3').each { |node| node.name = 'div' } |
| 15 | end | 8 | elsif slug == 'cordova_events_events.md' |
| 9 | css('h1:not(:first-child)').each { |node| node.name = 'h3' } | ||
| 10 | css('h2').each { |node| node.name = 'h4' } | ||
| 16 | end | 11 | end |
| 17 | 12 | ||
| 18 | css('hr').remove | 13 | css('hr').remove |
| @@ -16,7 +16,7 @@ module Docs · 15 unmodified lines | |||
| 16 | def additional_entries | 16 | def additional_entries |
| 17 | return [] unless slug == 'cordova_events_events.md' | 17 | return [] unless slug == 'cordova_events_events.md' |
| 18 | 18 | ||
| 19 | css('h2').map do |node| | 19 | css('h3').map do |node| |
| 20 | [node.content, node['id'], 'Events'] | 20 | [node.content, node['id'], 'Events'] |
| 21 | end | 21 | end |
| 22 | end | 22 | end |