Selaa lähdekoodia

Update Statsmodels documentation (0.8.0)

Thibaut Courouble 8 vuotta sitten
vanhempi
commit
9575c2a947

+ 2 - 2
lib/docs/filters/sphinx/clean_html.rb

@@ -17,10 +17,10 @@ module Docs
           node.before(node.children).remove
         end
 
-        css('div[class*="highlight-"]').each do |node|
+        css('div[class*="highlight-"]', 'div[class*="hl-"]').each do |node|
           pre = node.at_css('pre')
           pre.content = pre.content
-          lang = node['class'][/highlight\-(\w+)/, 1]
+          lang = node['class'][/highlight\-(\w+)/, 1] || node['class'][/hl\-(\w+)/, 1]
           lang = 'php' if lang == 'ci'
           lang = 'markup' if lang == 'html+django'
           lang = 'python' if lang == 'default' || lang.start_with?('python') || lang.start_with?('ipython')

+ 5 - 1
lib/docs/filters/statsmodels/clean_html.rb

@@ -2,7 +2,7 @@ module Docs
   class Statsmodels
     class CleanHtmlFilter < Filter
       def call
-        @doc = at_css('.body')
+        @doc = at_css('.body', '#notebook-container')
 
         if root_page?
           at_css('h1').content = 'Statsmodels'
@@ -11,6 +11,10 @@ module Docs
           at_css('#indices-and-tables').remove
         end
 
+        css('div.cell', 'div.inner_cell', 'div.text_cell_render', 'div.input_area').each do |node|
+          node.before(node.children).remove
+        end
+
         doc
       end
     end

+ 1 - 1
lib/docs/filters/statsmodels/entries.rb

@@ -9,7 +9,7 @@ module Docs
           name.remove! %r{\A(class(method)?) }
           name.remove! %r{\Astatsmodels\.}
         else
-          name = at_css('h1').content.strip
+          name = at_css('h1', 'h2').content.strip
           name.prepend 'Manual: ' if type == 'Manual'
           name.prepend 'Example: ' if type == 'Examples'
         end

+ 3 - 3
lib/docs/scrapers/statsmodels.rb

@@ -1,11 +1,11 @@
 module Docs
   class Statsmodels < UrlScraper
     self.type = 'sphinx'
-    self.release = '0.6.1'
-    self.base_url = 'http://statsmodels.sourceforge.net/stable/'
+    self.release = '0.8.0'
+    self.base_url = 'http://www.statsmodels.org/stable/'
     self.root_path = 'index.html'
     self.links = {
-      home: 'http://statsmodels.sourceforge.net/',
+      home: 'http://www.statsmodels.org/',
       code: 'https://github.com/statsmodels/statsmodels/'
     }