History

Finish Bash scraper

Thibaut Courouble committed 8 years ago

Commit a71f48e1 parent 1d5614410 files · +11 −9Browse files

Showing the changes to lib/docs (1 of 10 files). Show all

Unified · Split

lib/docs/filters/bash/clean_html.rb+11−0
@@ -11,6 +11,7 @@ module Docs · 10 unmodified lines
1111 # Remove chapter and section numbers from title
1212 title_node = at_css('h1, h2, h3, h4, h5, h6')
1313 title_node.content = title_node.content.gsub(/(\d+\.?)+/, '').strip
14+ title_node.name = 'h1'
1415
1516 # Remove the "D. " from names like "D. Concept Index" and "D. Function Index"
1617 title_node.content = title_node.content[3..-1] if title_node.content.start_with?("D. ")
@@ -56,6 +57,16 @@ module Docs · 39 unmodified lines
5657 node.children = link unless link.nil?
5758 end
5859
60+ css('tt', 'code', 'table').remove_attr('class')
61+
62+ css('tt').each do |node|
63+ node.name = 'code'
64+ end
65+
66+ css('pre').each do |node|
67+ node.content = node.content
68+ end
69+
5970 doc
6071 end
6172 end