Unified · Split
| @@ -1,13 +1,22 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Bash | 2 | class Bash |
| 3 | class EntriesFilter < Docs::EntriesFilter | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | |||
| 4 | def get_name | 5 | 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 | end | 20 | end |
| 12 | 21 | ||
| 13 | def get_type | 22 | def get_type |
| @@ -44,13 +53,14 @@ module Docs · 30 unmodified lines | |||
| 44 | end | 53 | end |
| 45 | 54 | ||
| 46 | # Construct path to the page which the index links to | 55 | # Construct path to the page which the index links to |
| 47 | entry_path = '/html_node/' + page + '#' + hash | 56 | entry_path = page + '#' + hash |
| 48 | 57 | ||
| 49 | entries << [entry_name, entry_path, entry_type] | 58 | entries << [entry_name, entry_path, entry_type] |
| 50 | end | 59 | end |
| 51 | 60 | ||
| 52 | entries | 61 | entries |
| 53 | end | 62 | end |
| 63 | |||
| 54 | end | 64 | end |
| 55 | end | 65 | end |
| 56 | end | 66 | end |
| @@ -1,9 +1,9 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Bash < UrlScraper | 2 | 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] = <<-HTML | 14 | options[:attribution] = <<-HTML |
| 17 | Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.<br> | 15 | Copyright © 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. |