Skip to content

Commit cfa5237

Browse files
authored
Merge pull request #1414 from MasterEnoc/bash
Update Bash to 5.1
2 parents e7675d8 + 846e354 commit cfa5237

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

lib/docs/filters/bash/entries.rb

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
module Docs
22
class Bash
33
class EntriesFilter < Docs::EntriesFilter
4+
45
def get_name
5-
name = at_css('hr + a + *').content.gsub(/(\d+\.?)+/, '')
6+
name = at_css('h1','h2', 'h3', 'h4').content.gsub(/(\d+\.?)+/, '')
7+
8+
# remove 'E.' notation for appendixes
9+
if name.match?(/[[:upper:]]\./)
10+
# remove 'E.'
11+
name.sub!(/[[:upper:]]\./, '')
12+
# remove all dots (.)
13+
name.gsub!(/\./, '')
14+
# remove all numbers
15+
name.gsub!(/[[:digit:]]/, '')
16+
end
617

7-
# Remove the "D. " from names like "D. Concept Index" and "D. Function Index"
8-
name = name[3..-1] if name.start_with?('D. ')
18+
name.strip
919

10-
name
1120
end
1221

1322
def get_type
@@ -44,13 +53,14 @@ def additional_entries
4453
end
4554

4655
# Construct path to the page which the index links to
47-
entry_path = '/html_node/' + page + '#' + hash
56+
entry_path = page + '#' + hash
4857

4958
entries << [entry_name, entry_path, entry_type]
5059
end
5160

5261
entries
5362
end
63+
5464
end
5565
end
5666
end

lib/docs/scrapers/bash.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
module Docs
22
class Bash < UrlScraper
33
self.type = 'bash'
4-
self.release = '5.0'
5-
self.base_url = 'https://www.gnu.org/software/bash/manual'
6-
self.root_path = '/html_node/index.html'
4+
self.release = '5.1'
5+
self.base_url = 'https://www.gnu.org/software/bash/manual/html_node'
6+
self.root_path = 'index.html'
77
self.links = {
88
home: 'https://www.gnu.org/software/bash/',
99
code: 'http://git.savannah.gnu.org/cgit/bash.git'
1010
}
1111

1212
html_filters.push 'bash/entries', 'bash/clean_html'
1313

14-
options[:only_patterns] = [/\/html_node\//]
15-
1614
options[:attribution] = <<-HTML
1715
Copyright &copy; 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.<br>
1816
Licensed under the GNU Free Documentation License.

0 commit comments

Comments
 (0)