History

Finish Fish scraper

Thibaut Courouble committed 10 years ago

Commit 575e5591 parent e25b05411 files · +29 −19Browse files

Unified · Split

11 files
  1. assets/images/docs.png +0 −0
  2. assets/images/docs@2x.png +0 −0
  3. assets/javascripts/news.json +1 −1
  4. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  5. assets/stylesheets/global/_icons.scss +1 −0
  6. lib/docs/filters/fish/clean_html.rb +2 −2
  7. lib/docs/filters/fish/entries.rb +18 −7
  8. lib/docs/scrapers/fish.rb +6 −12
  9. public/icons/docs/fish/16.png +0 −0
  10. public/icons/docs/fish/16@2x.png +0 −0
  11. public/icons/docs/fish/SOURCE +0 −1
assets/images/docs.png+0−0

Binary file not shown.

assets/images/docs@2x.png+0−0

Binary file not shown.

assets/javascripts/news.json+1−1
@@ -1,7 +1,7 @@
1[1[
2 [2 [
3 "2016-09-05",3 "2016-09-05",
4 "New documentation: <a href=\"/bottle/\">Bottle</a>"4 "New documentations: <a href=\"/fish/\">Fish</a> and <a href=\"/bottle/\">Bottle</a>"
5 ], [5 ], [
6 "2016-08-07",6 "2016-08-07",
7 "New documentation: <a href=\"/docker/\">Docker</a>"7 "New documentation: <a href=\"/docker/\">Docker</a>"
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -219,6 +219,11 @@ credits = [ · 218 unmodified lines
219 '2016 StrongLoop, IBM, and other expressjs.com contributors.',219 '2016 StrongLoop, IBM, and other expressjs.com contributors.',
220 'Unknown',220 'Unknown',
221 'https://github.com/expressjs/expressjs.com/issues/413'221 'https://github.com/expressjs/expressjs.com/issues/413'
222 ], [
223 'Fish',
224 '2005-2009 Axel Liljencrantz',
225 'GPLv2',
226 'https://fishshell.com/docs/current/license.html'
222 ], [227 ], [
223 'GCC<br>GNU Fortran',228 'GCC<br>GNU Fortran',
224 'Free Software Foundation',229 'Free Software Foundation',
assets/stylesheets/global/_icons.scss+1−0
@@ -116,6 +116,7 @@ · 115 unmodified lines
116._icon-socketio:before { background-position: -2rem -6rem; }116._icon-socketio:before { background-position: -2rem -6rem; }
117._icon-modernizr:before { background-position: -3rem -6rem; }117._icon-modernizr:before { background-position: -3rem -6rem; }
118._icon-bower:before { background-position: -4rem -6rem; }118._icon-bower:before { background-position: -4rem -6rem; }
119._icon-fish:before { background-position: -5rem -6rem; @extend %darkIconFix !optional; }
119._icon-bottle:before { background-position: 0 -7rem; }120._icon-bottle:before { background-position: 0 -7rem; }
120._icon-docker:before { background-position: -1rem -7rem; }121._icon-docker:before { background-position: -1rem -7rem; }
121._icon-cakephp:before { background-position: -2rem -7rem; }122._icon-cakephp:before { background-position: -2rem -7rem; }
lib/docs/filters/fish/clean_html.rb+2−2
@@ -14,12 +14,12 @@ module Docs · 13 unmodified lines
14 node.name = 'h2'14 node.name = 'h2'
15 end15 end
16 16
17 css('h2 > a').each do |node|17 css('.anchor').each do |node|
18 node.parent['id'] = node['id']18 node.parent['id'] = node['id']
19 end19 end
20 20
21 css('pre').each do |node|21 css('pre').each do |node|
22 node['class'] = 'fish' # Prism may support fish in the future22 node['data-language'] = 'fish' # Prism may support fish in the future
23 node.content = node.content23 node.content = node.content
24 end24 end
25 25
lib/docs/filters/fish/entries.rb+18−7
@@ -1,17 +1,28 @@
1module Docs1module Docs
2 class Fish2 class Fish
3 class EntriesFilter < Docs::EntriesFilter3 class EntriesFilter < Docs::EntriesFilter
4 def get_name
5 if slug == 'faq'
6 'FAQ'
7 else
8 slug.capitalize
9 end
10 end
4 11
5 def include_default_entry?12 def get_type
6 false13 if root_page? || slug == 'faq'
14 'Manual'
15 else
16 name
17 end
7 end18 end
8 19
9 def additional_entries20 def additional_entries
10 css('h2').each_with_object [] do |node, entries|21 return [] if slug == 'faq'
11 name = node.content.split(' - ').first22 css('h2').map.with_index do |node, i|
12 id = node['id']23 name = node.content.split(' - ').first.strip
13 type = root_page? ? 'Reference' : (slug == 'faq' ? 'FAQ' : slug.capitalize)24 name.prepend "#{i + 1}. " unless slug == 'commands'
14 entries << [name, id, type]25 [name, node['id'], get_type]
15 end26 end
16 end27 end
17 end28 end
lib/docs/scrapers/fish.rb+6−12
@@ -2,35 +2,29 @@ module Docs · 1 unmodified line
2 class Fish < UrlScraper2 class Fish < UrlScraper
3 self.name = 'Fish'3 self.name = 'Fish'
4 self.type = 'fish'4 self.type = 'fish'
5 self.root_path = 'index.html'
5 self.links = {6 self.links = {
6 home: 'http://fishshell.com/',7 home: 'https://fishshell.com/',
7 code: 'https://github.com/fish-shell/fish-shell'8 code: 'https://github.com/fish-shell/fish-shell'
8 }9 }
9 10
10 html_filters.push 'fish/clean_html', 'fish/entries'11 html_filters.push 'fish/clean_html', 'fish/entries'
11 12
12 options[:only] = %w(13 options[:skip] = %w(design.html license.html)
13 index.html
14 tutorial.html
15 commands.html
16 faq.html
17 )
18 14
19 options[:attribution] = <<-HTML15 options[:attribution] = <<-HTML
20 &copy; 2005&ndash;2009 Axel Liljencrantz<br>16 &copy; 2005&ndash;2009 Axel Liljencrantz<br>
21 &copy; 2009&ndash;2016 The fish contributors<br>
22 Licensed under the GNU General Public License, version 2.17 Licensed under the GNU General Public License, version 2.
23 HTML18 HTML
24 19
25 version '2.3' do20 version '2.3' do
26 self.release = '2.3.1'21 self.release = '2.3.1'
27 self.base_url = "http://fishshell.com/docs/#{version}/"22 self.base_url = "https://fishshell.com/docs/#{version}/"
28 self.root_path = 'index.html'
29 end23 end
24
30 version '2.2' do25 version '2.2' do
31 self.release = '2.2.0'26 self.release = '2.2.0'
32 self.base_url = "http://fishshell.com/docs/#{version}/"27 self.base_url = "https://fishshell.com/docs/#{version}/"
33 self.root_path = 'index.html'
34 end28 end
35 end29 end
36end30end
public/icons/docs/fish/16.png+0−0

Binary file not shown.

public/icons/docs/fish/16@2x.png+0−0

Binary file not shown.

public/icons/docs/fish/SOURCE+0−1
@@ -1 +0,0 @@
1https://github.com/fish-shell/fish-shell/blob/master/doc_src/ascii_fish.png