diff --git a/assets/stylesheets/pages/_sphinx.scss b/assets/stylesheets/pages/_sphinx.scss index a5984709..4572206c 100644 --- a/assets/stylesheets/pages/_sphinx.scss +++ b/assets/stylesheets/pages/_sphinx.scss @@ -37,6 +37,16 @@ .admonition-title + dl { padding-top: .5em; } td > div { margin: 0 !important; } + + .row-fluid { + h2 { + background: none; + border: none; + > a { + float: none; + } + } + } } ._sphinx { diff --git a/lib/docs/filters/scikit_learn/entries.rb b/lib/docs/filters/scikit_learn/entries.rb new file mode 100644 index 00000000..e203b378 --- /dev/null +++ b/lib/docs/filters/scikit_learn/entries.rb @@ -0,0 +1,54 @@ +module Docs + class ScikitLearn + class EntriesFilter < Docs::EntriesFilter + def get_name + # Classes, functions and methods + if subpath.start_with?('modules/generated') + name = at_css('dt').content.strip + name.sub! %r{\(.*}, '()' # Remove function arguments + name.remove! %r{[\=\[].*} # Remove [source] anchor + # name.remove! %r{\s=.*} # Remove the occasional '=' in class names + name.remove! %r{\A(class(method)?) (sklearn\.)?} + else + # User guide + name = at_css('h1').content.strip + end + + name.remove! "\u{00B6}" + name + end + + def get_type + # Classes, functions and methods + if subpath.start_with?('modules/generated') + type = at_css('dt > .descclassname').content.strip + type.remove! 'sklearn.' + type.remove! '.' + type + else + 'Guide' + end + end + + def additional_entries + entries = [] + + css('.class > dt[id]', '.exception > dt[id]', '.attribute > dt[id]').each do |node| + entries << [node['id'].remove('sklearn.'), node['id']] + end + + css('.data > dt[id]').each do |node| + if node['id'].split('.').last.upcase! # skip constants + entries << [node['id'].remove('sklearn.'), node['id']] + end + end + + css('.function > dt[id]', '.method > dt[id]', '.classmethod > dt[id]').each do |node| + entries << [node['id'].remove('sklearn.') + '()', node['id']] + end + + entries + end + end + end +end diff --git a/lib/docs/scrapers/scikit_learn.rb b/lib/docs/scrapers/scikit_learn.rb new file mode 100644 index 00000000..aa95ba17 --- /dev/null +++ b/lib/docs/scrapers/scikit_learn.rb @@ -0,0 +1,36 @@ +module Docs + class ScikitLearn < UrlScraper + self.name = 'scikit-learn' + self.slug = 'scikit_learn' + self.type = 'sphinx' + self.release = '0.17.1' + self.base_url = "http://scikit-learn.org/0.17/" + self.root_path = 'documentation.html' + self.initial_paths = %w( + user_guide.html + supervised_learning.html + unsupervised_learning.html + model_selection.html + data_transforms.html) + + self.links = { + home: 'http://scikit-learn.org/', + code: 'https://github.com/scikit-learn/scikit-learn' + } + + html_filters.push 'scikit_learn/entries', 'sphinx/clean_html' + + options[:container] = '.body' + + options[:root_title] = self.name + + options[:only] = self.initial_paths + options[:only_patterns] = [/\Amodules/, /\Adatasets/] + + options[:attribution] = <<-HTML + © 2007–2016 The scikit-learn deveopers
+ Licensed under the 3-clause BSD License. + HTML + + end +end diff --git a/public/icons/docs/scikit_learn/16.png b/public/icons/docs/scikit_learn/16.png new file mode 100644 index 00000000..e96f973d Binary files /dev/null and b/public/icons/docs/scikit_learn/16.png differ diff --git a/public/icons/docs/scikit_learn/16@2x.png b/public/icons/docs/scikit_learn/16@2x.png new file mode 100644 index 00000000..32ff0ffb Binary files /dev/null and b/public/icons/docs/scikit_learn/16@2x.png differ diff --git a/public/icons/docs/scikit_learn/SOURCE b/public/icons/docs/scikit_learn/SOURCE new file mode 100644 index 00000000..381f198a --- /dev/null +++ b/public/icons/docs/scikit_learn/SOURCE @@ -0,0 +1 @@ +http://scikit-learn.org/stable/_static/favicon.ico \ No newline at end of file