Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions lib/docs/filters/bash/entries.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
module Docs
class Bash
class EntriesFilter < Docs::EntriesFilter

def get_name
name = at_css('hr + a + *').content.gsub(/(\d+\.?)+/, '')
name = at_css('h1','h2', 'h3', 'h4').content.gsub(/(\d+\.?)+/, '')

# remove 'E.' notation for appendixes
if name.match?(/[[:upper:]]\./)
# remove 'E.'
name.sub!(/[[:upper:]]\./, '')
# remove all dots (.)
name.gsub!(/\./, '')
# remove all numbers
name.gsub!(/[[:digit:]]/, '')
end

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

name
end

def get_type
Expand Down Expand Up @@ -44,13 +53,14 @@ def additional_entries
end

# Construct path to the page which the index links to
entry_path = '/html_node/' + page + '#' + hash
entry_path = page + '#' + hash

entries << [entry_name, entry_path, entry_type]
end

entries
end

end
end
end
8 changes: 3 additions & 5 deletions lib/docs/scrapers/bash.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
module Docs
class Bash < UrlScraper
self.type = 'bash'
self.release = '5.0'
self.base_url = 'https://www.gnu.org/software/bash/manual'
self.root_path = '/html_node/index.html'
self.release = '5.1'
self.base_url = 'https://www.gnu.org/software/bash/manual/html_node'
self.root_path = 'index.html'
self.links = {
home: 'https://www.gnu.org/software/bash/',
code: 'http://git.savannah.gnu.org/cgit/bash.git'
}

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

options[:only_patterns] = [/\/html_node\//]

options[:attribution] = <<-HTML
Copyright &copy; 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.<br>
Licensed under the GNU Free Documentation License.
Expand Down