History

Finish scikit-image scraper

Thibaut Courouble committed 10 years ago

Commit 50f58321 parent 7f06c9c11 files · +30 −20Browse 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/scikit_image/clean_html.rb +0 −11
  7. lib/docs/filters/scikit_image/entries.rb +19 −4
  8. lib/docs/filters/sphinx/clean_html.rb +1 −1
  9. lib/docs/scrapers/scikit_image.rb +7 −7
  10. public/icons/docs/scikit_image/16.png +0 −0
  11. public/icons/docs/scikit_image/16@2x.png +0 −0
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 @@
11 [
22 [
33 "2016-09-05",
4− "New documentations: <a href=\"/fish/\">Fish</a> and <a href=\"/bottle/\">Bottle</a>"
4+ "New documentations: <a href=\"/fish/\">Fish</a>, <a href=\"/bottle/\">Bottle</a> and <a href=\"/scikit_image/\">scikit-image</a>"
55 ], [
66 "2016-08-07",
77 "New documentation: <a href=\"/docker/\">Docker</a>"
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -494,6 +494,11 @@ credits = [ · 493 unmodified lines
494494 '2006-2016 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein',
495495 'MIT',
496496 'https://raw.githubusercontent.com/sass/sass/stable/MIT-LICENSE'
497+ ], [
498+ 'scikit-image',
499+ '2011 the scikit-image team',
500+ 'BSD',
501+ 'http://scikit-image.org/docs/dev/license.html'
497502 ], [
498503 'Sinon',
499504 '2010-2016 Christian Johansen',
assets/stylesheets/global/_icons.scss+1−0
@@ -117,6 +117,7 @@ · 116 unmodified lines
117117 ._icon-modernizr:before { background-position: -3rem -6rem; }
118118 ._icon-bower:before { background-position: -4rem -6rem; }
119119 ._icon-fish:before { background-position: -5rem -6rem; @extend %darkIconFix !optional; }
120+._icon-scikit_image:before { background-position: -6rem -6rem; }
120121 ._icon-bottle:before { background-position: 0 -7rem; }
121122 ._icon-docker:before { background-position: -1rem -7rem; }
122123 ._icon-cakephp:before { background-position: -2rem -7rem; }
lib/docs/filters/scikit_image/clean_html.rb+0−11
@@ -1,11 +0,0 @@
1−module Docs
2− class ScikitImage
3− class CleanHtmlFilter < Filter
4− def call
5− css('h2').remove
6− css('h1 + table').remove
7− doc
8− end
9− end
10− end
11−end
lib/docs/filters/scikit_image/entries.rb+19−4
@@ -4,17 +4,27 @@ module Docs · 3 unmodified lines
44 def get_name
55 name = at_css('h1').content.strip
66 name.remove! "\u{00b6}"
7− name.remove! 'Module: '
8− name.remove! %r{ \(.*\)}
9− name.downcase!
7+
8+ if slug.start_with?('api')
9+ name.remove! 'Module: '
10+ name.remove! %r{ \(.*\)}
11+ name.downcase!
12+ end
13+
1014 name
1115 end
1216
1317 def get_type
14− name.split('.').first
18+ if slug.start_with?('api')
19+ name.split('.').first
20+ else
21+ 'Guide'
22+ end
1523 end
1624
1725 def additional_entries
26+ return [] unless slug.start_with?('api')
27+
1828 entries = []
1929
2030 css('.class > dt[id]', '.exception > dt[id]', '.attribute > dt[id]').each do |node|
@@ -30,8 +40,13 @@ module Docs · 9 unmodified lines
3040 css('.function > dt[id]', '.method > dt[id]', '.classmethod > dt[id]').each do |node|
3141 entries << [node['id'].remove('skimage.') + '()', node['id']]
3242 end
43+
3344 entries
3445 end
46+
47+ def include_default_entry?
48+ slug != 'api/api'
49+ end
3550 end
3651 end
3752 end
lib/docs/filters/sphinx/clean_html.rb+1−1
@@ -9,7 +9,7 @@ module Docs · 8 unmodified lines
99 node.remove
1010 end
1111
12− css('em.xref', 'tt').each do |node|
12+ css('em.xref', 'tt', 'cite').each do |node|
1313 node.name = 'code'
1414 end
1515
lib/docs/scrapers/scikit_image.rb+7−7
@@ -3,22 +3,22 @@ module Docs · 2 unmodified lines
33 self.name = 'scikit-image'
44 self.slug = 'scikit_image'
55 self.type = 'sphinx'
6− self.release = '0.12.2'
7− self.base_url = 'http://scikit-image.org/docs/0.12.x/api/'
8− self.root_path = 'api.html'
9−
6+ self.release = '0.12.3'
7+ self.base_url = 'http://scikit-image.org/docs/0.12.x/'
108 self.links = {
119 home: 'http://scikit-image.org/',
1210 code: 'https://github.com/scikit-image/scikit-image'
1311 }
1412
15− html_filters.push 'scikit_image/entries', 'scikit_image/clean_html', 'sphinx/clean_html'
13+ html_filters.push 'scikit_image/entries', 'sphinx/clean_html'
1614
1715 options[:container] = '.span9'
16+ options[:skip] = %w(api_changes.html)
17+ options[:only_patterns] = [/\Aapi/, /\Auser_guide/]
1818
1919 options[:attribution] = <<-HTML
20− &copy; 2011 the scikit-image development team<br>
21− Licensed under the scikit-image License.
20+ &copy; 2011 the scikit-image team<br>
21+ Licensed under the BSD 3-clause License.
2222 HTML
2323 end
2424 end
public/icons/docs/scikit_image/16.png+0−0

Binary file not shown.

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

Binary file not shown.