Finish Fish scraper

pull/481/head
Thibaut Courouble 9 years ago
parent e25b0542c3
commit 575e559c1c

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 124 KiB

@ -1,7 +1,7 @@
[
[
"2016-09-05",
"New documentation: <a href=\"/bottle/\">Bottle</a>"
"New documentations: <a href=\"/fish/\">Fish</a> and <a href=\"/bottle/\">Bottle</a>"
], [
"2016-08-07",
"New documentation: <a href=\"/docker/\">Docker</a>"

@ -219,6 +219,11 @@ credits = [
'2016 StrongLoop, IBM, and other expressjs.com contributors.',
'Unknown',
'https://github.com/expressjs/expressjs.com/issues/413'
], [
'Fish',
'2005-2009 Axel Liljencrantz',
'GPLv2',
'https://fishshell.com/docs/current/license.html'
], [
'GCC<br>GNU Fortran',
'Free Software Foundation',

@ -116,6 +116,7 @@
._icon-socketio:before { background-position: -2rem -6rem; }
._icon-modernizr:before { background-position: -3rem -6rem; }
._icon-bower:before { background-position: -4rem -6rem; }
._icon-fish:before { background-position: -5rem -6rem; @extend %darkIconFix !optional; }
._icon-bottle:before { background-position: 0 -7rem; }
._icon-docker:before { background-position: -1rem -7rem; }
._icon-cakephp:before { background-position: -2rem -7rem; }

@ -14,12 +14,12 @@ module Docs
node.name = 'h2'
end
css('h2 > a').each do |node|
css('.anchor').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['data-language'] = 'fish' # Prism may support fish in the future
node.content = node.content
end

@ -1,17 +1,28 @@
module Docs
class Fish
class EntriesFilter < Docs::EntriesFilter
def get_name
if slug == 'faq'
'FAQ'
else
slug.capitalize
end
end
def include_default_entry?
false
def get_type
if root_page? || slug == 'faq'
'Manual'
else
name
end
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]
return [] if slug == 'faq'
css('h2').map.with_index do |node, i|
name = node.content.split(' - ').first.strip
name.prepend "#{i + 1}. " unless slug == 'commands'
[name, node['id'], get_type]
end
end
end

@ -2,35 +2,29 @@ module Docs
class Fish < UrlScraper
self.name = 'Fish'
self.type = 'fish'
self.root_path = 'index.html'
self.links = {
home: 'http://fishshell.com/',
home: 'https://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[:skip] = %w(design.html license.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'
self.base_url = "https://fishshell.com/docs/#{version}/"
end
version '2.2' do
self.release = '2.2.0'
self.base_url = "http://fishshell.com/docs/#{version}/"
self.root_path = 'index.html'
self.base_url = "https://fishshell.com/docs/#{version}/"
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

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