mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
Add Fish Documentation
This commit is contained in:
parent
380afc40cd
commit
e25b0542c3
5 changed files with 87 additions and 0 deletions
|
@ -20,6 +20,7 @@
|
|||
._apache_pig,
|
||||
._chai,
|
||||
._docker,
|
||||
._fish,
|
||||
._gnu,
|
||||
._grunt,
|
||||
._haxe,
|
||||
|
|
30
lib/docs/filters/fish/clean_html.rb
Normal file
30
lib/docs/filters/fish/clean_html.rb
Normal 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
|
19
lib/docs/filters/fish/entries.rb
Normal file
19
lib/docs/filters/fish/entries.rb
Normal 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
36
lib/docs/scrapers/fish.rb
Normal 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
|
||||
© 2005–2009 Axel Liljencrantz<br>
|
||||
© 2009–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
|
1
public/icons/docs/fish/SOURCE
Normal file
1
public/icons/docs/fish/SOURCE
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/fish-shell/fish-shell/blob/master/doc_src/ascii_fish.png
|
Loading…
Reference in a new issue