History

Update Bash to 5.1

MasterEnoc committed 5 years ago

Commit 6c09ceb1 parent 23a00042 files · +18 −10Browse files

Unified · Split

2 files
  1. lib/docs/filters/bash/entries.rb +15 −5
  2. lib/docs/scrapers/bash.rb +3 −5
lib/docs/filters/bash/entries.rb+15−5
@@ -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 = name.sub(/[[:upper:]]\./, '')
12+ # remove all dots (.)
13+ name = name.gsub(/\./, '')
14+ # remove all numbers
15+ name = 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 @@ module Docs · 30 unmodified lines
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+3−5
@@ -1,9 +1,9 @@
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'
@@ -11,8 +11,6 @@ module Docs · 1 unmodified line
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.