Prechádzať zdrojové kódy

Statsmodels support

japborst 9 rokov pred
rodič
commit
06f5faeb18

+ 18 - 0
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

+ 30 - 0
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

+ 26 - 0
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
+      &copy; 2009&ndash;2012 Statsmodels Developers<br>
+      &copy; 2006&ndash;2008 Scipy Developers<br>
+      &copy; 2006 Jonathan E. Taylor<br>
+      Licensed under the 3-clause BSD License.
+    HTML
+
+  end
+end

BIN
public/icons/docs/statsmodels/16.png


BIN
public/icons/docs/statsmodels/16@2x.png


+ 1 - 0
public/icons/docs/statsmodels/SOURCE

@@ -0,0 +1 @@
+http://statsmodels.sourceforge.net/_static/statsmodels_hybi_favico.ico