Added Scraper for Scikit-Image (sqashed)

+ Scraper definition sourcing from http://scikit-image.org/docs/0.12.x/api/
+ Entries filter

Added clean_html and scikit_image icons
This commit is contained in:
Prashant Sinha 2016-08-28 15:00:50 +05:30 committed by Thibaut Courouble
parent df2a82f77c
commit 7f06c9c76e
6 changed files with 73 additions and 0 deletions

View file

@ -0,0 +1,11 @@
module Docs
class ScikitImage
class CleanHtmlFilter < Filter
def call
css('h2').remove
css('h1 + table').remove
doc
end
end
end
end

View file

@ -0,0 +1,37 @@
module Docs
class ScikitImage
class EntriesFilter < Docs::EntriesFilter
def get_name
name = at_css('h1').content.strip
name.remove! "\u{00b6}"
name.remove! 'Module: '
name.remove! %r{ \(.*\)}
name.downcase!
name
end
def get_type
name.split('.').first
end
def additional_entries
entries = []
css('.class > dt[id]', '.exception > dt[id]', '.attribute > dt[id]').each do |node|
entries << [node['id'].remove('skimage.'), node['id']]
end
css('.data > dt[id]').each do |node|
if node['id'].split('.').last.upcase!
entries << [node['id'].remove('skimage.'), node['id']]
end
end
css('.function > dt[id]', '.method > dt[id]', '.classmethod > dt[id]').each do |node|
entries << [node['id'].remove('skimage.') + '()', node['id']]
end
entries
end
end
end
end

View file

@ -0,0 +1,24 @@
module Docs
class ScikitImage < UrlScraper
self.name = 'scikit-image'
self.slug = 'scikit_image'
self.type = 'sphinx'
self.release = '0.12.2'
self.base_url = 'http://scikit-image.org/docs/0.12.x/api/'
self.root_path = 'api.html'
self.links = {
home: 'http://scikit-image.org/',
code: 'https://github.com/scikit-image/scikit-image'
}
html_filters.push 'scikit_image/entries', 'scikit_image/clean_html', 'sphinx/clean_html'
options[:container] = '.span9'
options[:attribution] = <<-HTML
&copy; 2011 the scikit-image development team<br>
Licensed under the scikit-image License.
HTML
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 942 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

@ -0,0 +1 @@
https://github.com/scikit-image/scikit-image/blob/master/doc/source/themes/scikit-image/static/img/favicon.ico