Unified · Split
| @@ -1,13 +1,22 @@ | ||
| 1 | 1 | module Docs |
| 2 | 2 | class Bash |
| 3 | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | + | |
| 4 | 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" | |
| 8 | − name = name[3..-1] if name.start_with?('D. ') | |
| 18 | + name.strip | |
| 9 | 19 | |
| 10 | − name | |
| 11 | 20 | end |
| 12 | 21 | |
| 13 | 22 | def get_type |
| @@ -44,13 +53,14 @@ module Docs · 30 unmodified lines | ||
| 44 | 53 | end |
| 45 | 54 | |
| 46 | 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 | 58 | entries << [entry_name, entry_path, entry_type] |
| 50 | 59 | end |
| 51 | 60 | |
| 52 | 61 | entries |
| 53 | 62 | end |
| 63 | + | |
| 54 | 64 | end |
| 55 | 65 | end |
| 56 | 66 | end |
| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | module Docs |
| 2 | 2 | class Bash < UrlScraper |
| 3 | 3 | 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' | |
| 7 | 7 | self.links = { |
| 8 | 8 | home: 'https://www.gnu.org/software/bash/', |
| 9 | 9 | code: 'http://git.savannah.gnu.org/cgit/bash.git' |
| @@ -11,8 +11,6 @@ module Docs · 1 unmodified line | ||
| 11 | 11 | |
| 12 | 12 | html_filters.push 'bash/entries', 'bash/clean_html' |
| 13 | 13 | |
| 14 | − options[:only_patterns] = [/\/html_node\//] | |
| 15 | − | |
| 16 | 14 | options[:attribution] = <<-HTML |
| 17 | 15 | Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.<br> |
| 18 | 16 | Licensed under the GNU Free Documentation License. |