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
11 # Remove chapter and section numbers from title11 # Remove chapter and section numbers from title
12 title_node = at_css('h1, h2, h3, h4, h5, h6')12 title_node = at_css('h1, h2, h3, h4, h5, h6')
13 title_node.content = title_node.content.gsub(/(\d+\.?)+/, '').strip13 title_node.content = title_node.content.gsub(/(\d+\.?)+/, '').strip
14 title_node.name = 'h1'
14 15
15 # Remove the "D. " from names like "D. Concept Index" and "D. Function Index"16 # Remove the "D. " from names like "D. Concept Index" and "D. Function Index"
16 title_node.content = title_node.content[3..-1] if title_node.content.start_with?("D. ")17 title_node.content = title_node.content[3..-1] if title_node.content.start_with?("D. ")
@@ -56,6 +57,16 @@ module Docs · 39 unmodified lines
56 node.children = link unless link.nil?57 node.children = link unless link.nil?
57 end58 end
58 59
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
59 doc70 doc
60 end71 end
61 end72 end