Add Fish Documentation

This commit is contained in:
Phil Scherer 2016-08-22 18:24:09 -04:00 committed by Thibaut Courouble
parent 380afc40cd
commit e25b0542c3
5 changed files with 87 additions and 0 deletions

View file

@ -20,6 +20,7 @@
._apache_pig,
._chai,
._docker,
._fish,
._gnu,
._grunt,
._haxe,

View file

@ -0,0 +1,30 @@
module Docs
class Fish
class CleanHtmlFilter < Filter
def call
@doc = at_css('.fish_right_bar')
css('hr').remove
css('h2').each do |node|
node.name = 'h3'
end
css('h1').drop(1).each do |node|
node.name = 'h2'
end
css('h2 > a').each do |node|
node.parent['id'] = node['id']
end
css('pre').each do |node|
node['class'] = 'fish' # Prism may support fish in the future
node.content = node.content
end
doc
end
end
end
end

View file

@ -0,0 +1,19 @@
module Docs
class Fish
class EntriesFilter < Docs::EntriesFilter
def include_default_entry?
false
end
def additional_entries
css('h2').each_with_object [] do |node, entries|
name = node.content.split(' - ').first
id = node['id']
type = root_page? ? 'Reference' : (slug == 'faq' ? 'FAQ' : slug.capitalize)
entries << [name, id, type]
end
end
end
end
end

36
lib/docs/scrapers/fish.rb Normal file
View file

@ -0,0 +1,36 @@
module Docs
class Fish < UrlScraper
self.name = 'Fish'
self.type = 'fish'
self.links = {
home: 'http://fishshell.com/',
code: 'https://github.com/fish-shell/fish-shell'
}
html_filters.push 'fish/clean_html', 'fish/entries'
options[:only] = %w(
index.html
tutorial.html
commands.html
faq.html
)
options[:attribution] = <<-HTML
&copy; 2005&ndash;2009 Axel Liljencrantz<br>
&copy; 2009&ndash;2016 The fish contributors<br>
Licensed under the GNU General Public License, version 2.
HTML
version '2.3' do
self.release = '2.3.1'
self.base_url = "http://fishshell.com/docs/#{version}/"
self.root_path = 'index.html'
end
version '2.2' do
self.release = '2.2.0'
self.base_url = "http://fishshell.com/docs/#{version}/"
self.root_path = 'index.html'
end
end
end

View file

@ -0,0 +1 @@
https://github.com/fish-shell/fish-shell/blob/master/doc_src/ascii_fish.png