From 06f5faeb185dcbebccb51196ef3ee1fec32aad73 Mon Sep 17 00:00:00 2001 From: japborst Date: Sun, 2 Oct 2016 18:31:55 +0200 Subject: [PATCH] Statsmodels support --- lib/docs/filters/statsmodels/clean_html.rb | 18 +++++++++++++ lib/docs/filters/statsmodels/entries.rb | 30 +++++++++++++++++++++ lib/docs/scrapers/statsmodels.rb | 26 ++++++++++++++++++ public/icons/docs/statsmodels/16.png | Bin 0 -> 832 bytes public/icons/docs/statsmodels/16@2x.png | Bin 0 -> 2222 bytes public/icons/docs/statsmodels/SOURCE | 1 + 6 files changed, 75 insertions(+) create mode 100644 lib/docs/filters/statsmodels/clean_html.rb create mode 100644 lib/docs/filters/statsmodels/entries.rb create mode 100644 lib/docs/scrapers/statsmodels.rb create mode 100644 public/icons/docs/statsmodels/16.png create mode 100644 public/icons/docs/statsmodels/16@2x.png create mode 100644 public/icons/docs/statsmodels/SOURCE 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 0000000000000000000000000000000000000000..4803b55fde6c70f856c059c4dd4e6da49e83473e GIT binary patch literal 832 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJOS+@4BLl<6e(pbstU$g(vPY0F z14ES>14Ba#1H&(%P{RubhEf9thF1v;3|2E37{m+a>zTe)%7+N~S6?%lTg@b3L54jegq-?r=U{=;Wt6H>0- zemZIDoNc=fUATI`vbr%dr!Y7)^74&G8@BA3IcITMWnE2u%axmtCrp`@S6H@o<4(VT zkgGQzuiLci@{NZp*KR#^?)t?NMQuIvxE7`c=gW-qb{1PZXOzr&Ry`#s24rf+tTVkHH+(qC_KmqbLnFr;Hwtp2@+I=Y0KQUK!-~PZGKKY@U$G1P6(YRsrZufV_`Em>D zIu<{keA&3!CVvGtYfM*Vsqgc)J-LUjHk`TpfB6EAJGUKPJ^c9c=g}hD*I(CWnkqc~ z-hblxbiv-*{}rlt*Z;{q41jDCAX!l{{UM5m-29Zxv`X9>I92syff^V*UHx3vIVCg! E05&_FC;$Ke literal 0 HcmV?d00001 diff --git a/public/icons/docs/statsmodels/16@2x.png b/public/icons/docs/statsmodels/16@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..0c9d6c9388ff4f11a26df8aea028b75499e9e4ed GIT binary patch literal 2222 zcmV;f2vPTmP) z_4ubv8d`esf4kH-cN;!8xAmK*_5o?_9Hz0NhnR%{6VuP(!RyKq&mC#4D2m(+|rxq$=Vko2@l7+nkN?Cs1vixb$qqDqr_ zr`V)r6<{o1ZfE4%EB{EAOV^TYRPxR3K(&pXwywEbH4lh2?cnIF_0BD-gfZ6L15*|*Hhsfh(>v&qzTs)pJLHxA zkr_KMI?H#<@s^GO+txK=21aHK7BT%J(?J;+oq^1n;c>qip75KI$vHa$SC3A8BghAt zKz?B!!qmu+2NP8d=oy%#0hY-&J+~03gasQan5Tko|CewRSNG!}@Qfe_g5z2R?cF0b zJGaEbQn-a1IX^5H#w;;8-6H0eMmq*QPF5Pw-9Ksb3d?0^+#g~9GO?p)R5Ek!s%xBD zT`8=JtuMbSKm5^;<>_BMBX7L?wE#v9>~ZkV$5s^ z5Q(c1fAj3x4YK=>d$pvH6Y`svwn2L(>7SVrckbefdMC)t%>9daq3ck0_Kq7Qx%3Tr zgX0>47Mvh8Jy!>m; zVdFGFF|s*WTHb)%O3Sg~o1U`=4t{FCj=!dOL11!mA^virj=k{WOF+RI9m7HFGr#Qr zq~+SG`Znieiqi|L$`l~={G|l@+wH&81rA3C7Z3+dK^+=r~Qu+C!XfzZLewXcz^GH;)v$U(3lTxyjOVv z!};OwflW%J^#a?=WYVJ!8i2T@c^=v)&NkHdbute^L(qln{|Hp$O+lF`8j#= z$)C#JeFp$s!@3C}eB-7q+LXM(9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