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 @@
1module Docs1module Docs
2 class Bash2 class Bash
3 class EntriesFilter < Docs::EntriesFilter3 class EntriesFilter < Docs::EntriesFilter
4
4 def get_name5 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
6 17
7 # Remove the "D. " from names like "D. Concept Index" and "D. Function Index"18 name.strip
8 name = name[3..-1] if name.start_with?('D. ')
9 19
10 name
11 end20 end
12 21
13 def get_type22 def get_type
@@ -44,13 +53,14 @@ module Docs · 30 unmodified lines
44 end53 end
45 54
46 # Construct path to the page which the index links to55 # Construct path to the page which the index links to
47 entry_path = '/html_node/' + page + '#' + hash56 entry_path = page + '#' + hash
48 57
49 entries << [entry_name, entry_path, entry_type]58 entries << [entry_name, entry_path, entry_type]
50 end59 end
51 60
52 entries61 entries
53 end62 end
63
54 end64 end
55 end65 end
56end66end
lib/docs/scrapers/bash.rb+3−5
@@ -1,9 +1,9 @@
1module Docs1module Docs
2 class Bash < UrlScraper2 class Bash < UrlScraper
3 self.type = 'bash'3 self.type = 'bash'
4 self.release = '5.0'4 self.release = '5.1'
5 self.base_url = 'https://www.gnu.org/software/bash/manual'5 self.base_url = 'https://www.gnu.org/software/bash/manual/html_node'
6 self.root_path = '/html_node/index.html'6 self.root_path = 'index.html'
7 self.links = {7 self.links = {
8 home: 'https://www.gnu.org/software/bash/',8 home: 'https://www.gnu.org/software/bash/',
9 code: 'http://git.savannah.gnu.org/cgit/bash.git'9 code: 'http://git.savannah.gnu.org/cgit/bash.git'
@@ -11,8 +11,6 @@ module Docs · 1 unmodified line
11 11
12 html_filters.push 'bash/entries', 'bash/clean_html'12 html_filters.push 'bash/entries', 'bash/clean_html'
13 13
14 options[:only_patterns] = [/\/html_node\//]
15
16 options[:attribution] = <<-HTML14 options[:attribution] = <<-HTML
17 Copyright &copy; 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.<br>15 Copyright &copy; 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.<br>
18 Licensed under the GNU Free Documentation License.16 Licensed under the GNU Free Documentation License.