mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
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:
parent
df2a82f77c
commit
7f06c9c76e
6 changed files with 73 additions and 0 deletions
11
lib/docs/filters/scikit_image/clean_html.rb
Normal file
11
lib/docs/filters/scikit_image/clean_html.rb
Normal 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
|
37
lib/docs/filters/scikit_image/entries.rb
Normal file
37
lib/docs/filters/scikit_image/entries.rb
Normal 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
|
24
lib/docs/scrapers/scikit_image.rb
Normal file
24
lib/docs/scrapers/scikit_image.rb
Normal 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
|
||||
© 2011 the scikit-image development team<br>
|
||||
Licensed under the scikit-image License.
|
||||
HTML
|
||||
end
|
||||
end
|
BIN
public/icons/docs/scikit_image/16.png
Normal file
BIN
public/icons/docs/scikit_image/16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 942 B |
BIN
public/icons/docs/scikit_image/16@2x.png
Normal file
BIN
public/icons/docs/scikit_image/16@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
1
public/icons/docs/scikit_image/SOURCE
Normal file
1
public/icons/docs/scikit_image/SOURCE
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/scikit-image/scikit-image/blob/master/doc/source/themes/scikit-image/static/img/favicon.ico
|
Loading…
Reference in a new issue