فهرست منبع

Finish Statsmodels scraper

Thibaut Courouble 9 سال پیش
والد
کامیت
4847917e61

BIN
assets/images/docs.png


BIN
assets/images/docs@2x.png


+ 1 - 1
assets/javascripts/news.json

@@ -1,7 +1,7 @@
 [
   [
     "2016-10-10",
-    "New documentation: <a href=\"/scikit_learn/\">scikit-learn</a>"
+    "New documentations: <a href=\"/scikit_learn/\">scikit-learn</a> and <a href=\"/statsmodels/\">Statsmodels</a>"
   ], [
     "2016-09-18",
     "New documentations: <a href=\"/pandas/\">pandas</a> and <a href=\"/twig/\">Twig</a>"

+ 5 - 0
assets/javascripts/templates/pages/about_tmpl.coffee

@@ -519,6 +519,11 @@ credits = [
     '2014-2015 Automattic',
     'MIT',
     'https://raw.githubusercontent.com/Automattic/socket.io/master/LICENSE'
+  ], [
+    'Statsmodels',
+    '2009-2012 Statsmodels Developers<br>&copy; 2006-2008 Scipy Developers<br>&copy; 2006 Jonathan E. Taylor',
+    'BSD',
+    'https://raw.githubusercontent.com/statsmodels/statsmodels/master/LICENSE.txt'
   ], [
     'Symfony',
     '2004-2016 Fabien Potencier',

+ 1 - 0
assets/stylesheets/global/_icons.scss

@@ -88,6 +88,7 @@
 ._icon-knockout:before      { background-position: -5rem -3rem; }
 ._icon-moment:before        { background-position: -6rem -3rem; @extend %darkIconFix !optional; }
 ._icon-c:before             { background-position: -7rem -3rem; }
+._icon-statsmodels:before   { background-position: -8rem -3rem; }
 ._icon-yii:before,
 ._icon-yii1:before          { background-position: -9rem -3rem; }
 ._icon-cpp:before           { background-position: 0 -4rem; }

+ 0 - 2
lib/docs/filters/pandas/clean_html.rb

@@ -13,8 +13,6 @@ module Docs
           node.before(node.children).remove
         end
 
-        css('.anchor-link').remove
-
         doc
       end
     end

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

@@ -2,7 +2,7 @@ module Docs
   class Sphinx
     class CleanHtmlFilter < Filter
       def call
-        css('.headerlink', 'hr', '#contents .topic-title', '#topics .topic-title', 'colgroup', '.line-block').remove
+        css('.headerlink', 'hr', '#contents .topic-title', '#topics .topic-title', 'colgroup', '.line-block', '.anchor-link').remove
 
         css('.contents > ul:first-child:last-child.simple > li:first-child:last-child').each do |node|
           node.parent.before(node.at_css('> ul')) if node.at_css('> ul')

+ 4 - 4
lib/docs/filters/statsmodels/clean_html.rb

@@ -5,10 +5,10 @@ module Docs
         @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
+          at_css('h1').content = 'Statsmodels'
+          at_css('#basic-documentation').remove
+          at_css('#table-of-contents').remove
+          at_css('#indices-and-tables').remove
         end
 
         doc

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

@@ -6,9 +6,12 @@ module Docs
           name = at_css('dt').content.strip
           name.sub! %r{\(.*}, '()' # Remove method arguments
           name.remove! %r{[\=\[].*} # Remove "[source]"
-          name.remove! %r{\A(class(method)?) (statsmodels\.)?}
+          name.remove! %r{\A(class(method)?) }
+          name.remove! %r{\Astatsmodels\.}
         else
           name = at_css('h1').content.strip
+          name.prepend 'Manual: ' if type == 'Manual'
+          name.prepend 'Example: ' if type == 'Examples'
         end
         name.remove! "\u{00B6}" # Remove ¶
         name

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

@@ -1,9 +1,8 @@
 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.base_url = 'http://statsmodels.sourceforge.net/stable/'
     self.root_path = 'index.html'
     self.links = {
       home: 'http://statsmodels.sourceforge.net/',
@@ -12,7 +11,7 @@ module Docs
 
     html_filters.push 'statsmodels/entries', 'statsmodels/clean_html', 'sphinx/clean_html'
 
-    options[:skip] = %w(about.html)
+    options[:skip] = %w(about.html search.html genindex.html)
     options[:skip_patterns] = [/\Arelease/, /\Adev/, /\A_modules/, /\Adatasets/]
 
     options[:attribution] = <<-HTML

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


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