diff --git a/lib/docs/filters/statsmodels/clean_html.rb b/lib/docs/filters/statsmodels/clean_html.rb new file mode 100644 index 00000000..b5c758b8 --- /dev/null +++ b/lib/docs/filters/statsmodels/clean_html.rb @@ -0,0 +1,18 @@ +module Docs + class Statsmodels + class CleanHtmlFilter < Filter + def call + @doc = at_css('.body') + + if root_page? + at_css('h1').content = 'Statsmodels' + at_css('#basic-documentation').remove + at_css('#table-of-contents').remove + at_css('#indices-and-tables').remove + end + + doc + end + end + end +end diff --git a/lib/docs/filters/statsmodels/entries.rb b/lib/docs/filters/statsmodels/entries.rb new file mode 100644 index 00000000..c4cc5b5e --- /dev/null +++ b/lib/docs/filters/statsmodels/entries.rb @@ -0,0 +1,30 @@ +module Docs + class Statsmodels + class EntriesFilter < Docs::EntriesFilter + def get_name + if subpath.start_with?('generated') + name = at_css('dt').content.strip + name.sub! %r{\(.*}, '()' # Remove method arguments + name.remove! %r{[\=\[].*} # Remove "[source]" + name.remove! %r{\A(class(method)?) (statsmodels\.)?} + else + name = at_css('h1').content.strip + end + name.remove! "\u{00B6}" # Remove ΒΆ + name + end + + def get_type + if subpath.start_with?('generated') + # '> text()' doesn't include children's text in type naming + at_xpath('//div[@class="related"]//li[not(@class="right")][7]/a/text()').content + + elsif subpath.start_with?('examples') + 'Examples' + else + 'Manual' + end + end + end + end +end diff --git a/lib/docs/scrapers/statsmodels.rb b/lib/docs/scrapers/statsmodels.rb new file mode 100644 index 00000000..d2d3fb15 --- /dev/null +++ b/lib/docs/scrapers/statsmodels.rb @@ -0,0 +1,26 @@ +module Docs + class Statsmodels < UrlScraper + self.name = 'Statsmodels' + self.type = 'sphinx' + self.release = '0.6.1' + self.base_url = "http://statsmodels.sourceforge.net/stable/" + self.root_path = 'index.html' + self.links = { + home: 'http://statsmodels.sourceforge.net/', + code: 'https://github.com/statsmodels/statsmodels/' + } + + html_filters.push 'statsmodels/entries', 'statsmodels/clean_html', 'sphinx/clean_html' + + options[:skip] = %w(about.html) + options[:skip_patterns] = [/\Arelease/, /\Adev/, /\A_modules/, /\Adatasets/] + + options[:attribution] = <<-HTML + © 2009–2012 Statsmodels Developers
+ © 2006–2008 Scipy Developers
+ © 2006 Jonathan E. Taylor
+ Licensed under the 3-clause BSD License. + HTML + + end +end diff --git a/public/icons/docs/statsmodels/16.png b/public/icons/docs/statsmodels/16.png new file mode 100644 index 00000000..4803b55f Binary files /dev/null and b/public/icons/docs/statsmodels/16.png differ diff --git a/public/icons/docs/statsmodels/16@2x.png b/public/icons/docs/statsmodels/16@2x.png new file mode 100644 index 00000000..0c9d6c93 Binary files /dev/null and b/public/icons/docs/statsmodels/16@2x.png differ diff --git a/public/icons/docs/statsmodels/SOURCE b/public/icons/docs/statsmodels/SOURCE new file mode 100644 index 00000000..42e40bd4 --- /dev/null +++ b/public/icons/docs/statsmodels/SOURCE @@ -0,0 +1 @@ +http://statsmodels.sourceforge.net/_static/statsmodels_hybi_favico.ico \ No newline at end of file