diff --git a/assets/stylesheets/pages/_simple.scss b/assets/stylesheets/pages/_simple.scss index 23529107..379f5533 100644 --- a/assets/stylesheets/pages/_simple.scss +++ b/assets/stylesheets/pages/_simple.scss @@ -20,6 +20,7 @@ ._apache_pig, ._chai, ._docker, +._fish, ._gnu, ._grunt, ._haxe, diff --git a/lib/docs/filters/fish/clean_html.rb b/lib/docs/filters/fish/clean_html.rb new file mode 100644 index 00000000..640b4d60 --- /dev/null +++ b/lib/docs/filters/fish/clean_html.rb @@ -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 diff --git a/lib/docs/filters/fish/entries.rb b/lib/docs/filters/fish/entries.rb new file mode 100644 index 00000000..6b878d90 --- /dev/null +++ b/lib/docs/filters/fish/entries.rb @@ -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 diff --git a/lib/docs/scrapers/fish.rb b/lib/docs/scrapers/fish.rb new file mode 100644 index 00000000..73357195 --- /dev/null +++ b/lib/docs/scrapers/fish.rb @@ -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
+ © 2009–2016 The fish contributors
+ 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 diff --git a/public/icons/docs/fish/SOURCE b/public/icons/docs/fish/SOURCE new file mode 100644 index 00000000..7c7fa625 --- /dev/null +++ b/public/icons/docs/fish/SOURCE @@ -0,0 +1 @@ +https://github.com/fish-shell/fish-shell/blob/master/doc_src/ascii_fish.png