From 9575c2a9471625206bd03b5dd7d492b0b346db61 Mon Sep 17 00:00:00 2001 From: Thibaut Courouble Date: Mon, 22 May 2017 12:58:55 -0400 Subject: [PATCH] Update Statsmodels documentation (0.8.0) --- lib/docs/filters/sphinx/clean_html.rb | 4 ++-- lib/docs/filters/statsmodels/clean_html.rb | 6 +++++- lib/docs/filters/statsmodels/entries.rb | 2 +- lib/docs/scrapers/statsmodels.rb | 6 +++--- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/docs/filters/sphinx/clean_html.rb b/lib/docs/filters/sphinx/clean_html.rb index bbb064ea..9775122c 100644 --- a/lib/docs/filters/sphinx/clean_html.rb +++ b/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') diff --git a/lib/docs/filters/statsmodels/clean_html.rb b/lib/docs/filters/statsmodels/clean_html.rb index 6234909a..79e34241 100644 --- a/lib/docs/filters/statsmodels/clean_html.rb +++ b/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 diff --git a/lib/docs/filters/statsmodels/entries.rb b/lib/docs/filters/statsmodels/entries.rb index cddc9d64..e0d0f429 100644 --- a/lib/docs/filters/statsmodels/entries.rb +++ b/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 diff --git a/lib/docs/scrapers/statsmodels.rb b/lib/docs/scrapers/statsmodels.rb index 723fb4fd..283141ab 100644 --- a/lib/docs/scrapers/statsmodels.rb +++ b/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/' }