History

Update Bash documentation (5.3)

Simon Legner committed 1 year ago

Commit 8fd21cc1 parent 9b010af3 files · +7 −6Browse files

Unified · Split

3 files
  1. lib/docs/filters/bash/clean_html.rb +4 −4
  2. lib/docs/filters/bash/entries.rb +2 −1
  3. lib/docs/scrapers/bash.rb +1 −1
lib/docs/filters/bash/clean_html.rb+4−4
@@ -4,16 +4,16 @@ module Docs · 3 unmodified lines
4 def call4 def call
5 @doc = at_css('> div[id]') if at_css('> div[id]')5 @doc = at_css('> div[id]') if at_css('> div[id]')
6 # Remove the navigation header and footer and the lines underneath and above it6 # Remove the navigation header and footer and the lines underneath and above it
7 at_css('.header + hr').remove7 at_css('.nav-panel + hr').remove
8 line_above = at_xpath('//div[@class="header"]/preceding::hr[1]')8 line_above = at_xpath('//div[@class="header"]/preceding::hr[1]')
9 line_above.remove unless line_above.nil?9 line_above.remove unless line_above.nil?
10 css('.header').remove10 css('.nav-panel').remove
11 11
12 css('.copiable-anchor').remove12 css('.copiable-anchor').remove
13 13
14 # Remove chapter and section numbers from title14 # Remove chapter and section numbers from title
15 title_node = at_css('h1, h2, h3, h4, h5, h6')15 title_node = at_css('h1, h2, h3, h4, h5, h6')
16 title_node.content = title_node.content.gsub(/(\d+\.?)+/, '').strip16 title_node.content = title_node.content.gsub(/(\d+\.?)+/, '').gsub('¶', '').strip
17 title_node.name = 'h1'17 title_node.name = 'h1'
18 18
19 # Remove the "D. " from names like "D. Concept Index" and "D. Function Index"19 # Remove the "D. " from names like "D. Concept Index" and "D. Function Index"
@@ -52,7 +52,7 @@ module Docs · 32 unmodified lines
52 end52 end
53 53
54 # Remove the rows with a horizontal line in them from the index tables54 # Remove the rows with a horizontal line in them from the index tables
55 css('td[colspan="4"]').remove55 css('td[colspan="3"]').remove
56 56
57 # Remove additional text from menu entry and index entry cells57 # Remove additional text from menu entry and index entry cells
58 css('td[valign=top]').each do |node|58 css('td[valign=top]').each do |node|
lib/docs/filters/bash/entries.rb+2−1
@@ -15,6 +15,7 @@ module Docs · 14 unmodified lines
15 name.gsub!(/[[:digit:]]/, '')15 name.gsub!(/[[:digit:]]/, '')
16 end16 end
17 17
18 name.remove! '¶'
18 name.strip19 name.strip
19 20
20 end21 end
@@ -38,7 +39,7 @@ module Docs · 17 unmodified lines
38 39
39 entries = []40 entries = []
40 41
41 css('table[class^=index-] td[valign=top] > a').each_slice(2) do |entry_node, section_node|42 css('dt > a').each_slice(2) do |entry_node, section_node|
42 entry_name = entry_node.content43 entry_name = entry_node.content
43 entry_path = entry_node['href']44 entry_path = entry_node['href']
44 entries << [entry_name, entry_path, entry_type]45 entries << [entry_name, entry_path, entry_type]
lib/docs/scrapers/bash.rb+1−1
@@ -1,7 +1,7 @@
1module Docs1module Docs
2 class Bash < FileScraper2 class Bash < FileScraper
3 self.type = 'bash'3 self.type = 'bash'
4 self.release = '5.2'4 self.release = '5.3'
5 self.base_url = 'https://www.gnu.org/software/bash/manual/html_node'5 self.base_url = 'https://www.gnu.org/software/bash/manual/html_node'
6 self.root_path = 'index.html'6 self.root_path = 'index.html'
7 self.links = {7 self.links = {