diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 712ca07b..bdd0c84d 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -573,7 +573,7 @@ credits = [ 'https://raw.githubusercontent.com/padrino/padrino-framework/master/padrino/LICENSE.txt' ], [ 'pandas', - '2008-2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team', + '2008-2020, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team', 'BSD', 'https://raw.githubusercontent.com/pydata/pandas/master/LICENSE' ], [ diff --git a/lib/docs/filters/pandas/clean_html.rb b/lib/docs/filters/pandas/clean_html.rb index 3bba131c..2234945d 100644 --- a/lib/docs/filters/pandas/clean_html.rb +++ b/lib/docs/filters/pandas/clean_html.rb @@ -2,16 +2,22 @@ module Docs class Pandas class CleanHtmlFilter < Filter def call - @doc = at_css('.body') - if root_page? - css('a[href$=".zip"]', 'a[href$=".pdf"]', '.toctree-wrapper').remove - at_css('h1').content = 'pandas' - end + css('#navbar-main').remove - css('h2 > a.reference', 'h3 > a.reference').each do |node| - node.before(node.children).remove - end + css('form').remove + + # sidebar + css('ul.nav.bd-sidenav').remove + + # title side symbol + css('.headerlink').remove + + # next and previous section buttons + css('next-link').remove + css('prev-link').remove + + css('footer').remove doc end diff --git a/lib/docs/filters/pandas/clean_html_old.rb b/lib/docs/filters/pandas/clean_html_old.rb new file mode 100644 index 00000000..140ae682 --- /dev/null +++ b/lib/docs/filters/pandas/clean_html_old.rb @@ -0,0 +1,20 @@ +module Docs + class Pandas + class CleanHtmlOldFilter < Filter + def call + @doc = at_css('.body') + + if root_page? + css('a[href$=".zip"]', 'a[href$=".pdf"]', '.toctree-wrapper').remove + at_css('h1').content = 'pandas' + end + + css('h2 > a.reference', 'h3 > a.reference').each do |node| + node.before(node.children).remove + end + + doc + end + end + end +end diff --git a/lib/docs/filters/pandas/entries.rb b/lib/docs/filters/pandas/entries.rb index badf5e22..79c5f3a6 100644 --- a/lib/docs/filters/pandas/entries.rb +++ b/lib/docs/filters/pandas/entries.rb @@ -1,29 +1,29 @@ module Docs class Pandas class EntriesFilter < Docs::EntriesFilter + def get_name - if subpath.start_with?('generated') || (subpath.include?('reference') && !subpath.include?('reference/index')) - name_node = at_css('dt') - name_node = at_css('h1') if name_node.nil? - name = name_node.content.strip - name.sub! %r{\(.*}, '()' - name.remove! %r{\s=.*} - name.remove! %r{\A(class(method)?) (pandas\.)?} - else - name = at_css('h1').content.strip - name.prepend "#{css('.toctree-l1 > a:not([href^="http"])').to_a.index(at_css('.toctree-l1.current > a')) + 1}. " - end - name.remove! "\u{00B6}" - name + at_css('h1').content end def get_type - if subpath.start_with?('generated') || (subpath.include?('reference') && !subpath.include?('reference/index')) - css('.toctree-l2.current > a').last.content.remove(/\s\(.+?\)/) - else - 'Manual' - end + return 'Manual' if slug.include?('user_guide') + return 'General utility functions' if slug.match?('option|assert|errors|types|show_versions') + return 'Extensions' if slug.match?(/extensions|check_array/) + return 'Style' if slug.match?(/style/) + return 'Input/output' if slug.match?(/read|io|HDFStore/) + return 'Series' if slug.match?(/Series/) + return 'GroupBy' if slug.match?(/groupby|Grouper/) + return 'DataFrame' if slug.match?(/DataFrame|frame/) + return 'Window' if slug.match?(/window|indexers/) + return 'Index Objects' if slug.match?(/Index|indexing/) + return 'Data offsets' if slug.match?(/offsets?/) + return 'Resampling' if slug.match?(/resample/) + return 'Plotting' if slug.match?(/plotting/) + return 'Pandas arrays' if slug.match?(/arrays?|Timestamp|Datetime|Timedelta|Period|Interval|Categorical|Dtype/) + 'General functions' end + end end end diff --git a/lib/docs/filters/pandas/entries_old.rb b/lib/docs/filters/pandas/entries_old.rb new file mode 100644 index 00000000..139d7b7e --- /dev/null +++ b/lib/docs/filters/pandas/entries_old.rb @@ -0,0 +1,29 @@ +module Docs + class Pandas + class EntriesOldFilter < Docs::EntriesFilter + def get_name + if subpath.start_with?('generated') || (subpath.include?('reference') && !subpath.include?('reference/index')) + name_node = at_css('dt') + name_node = at_css('h1') if name_node.nil? + name = name_node.content.strip + name.sub! %r{\(.*}, '()' + name.remove! %r{\s=.*} + name.remove! %r{\A(class(method)?) (pandas\.)?} + else + name = at_css('h1').content.strip + name.prepend "#{css('.toctree-l1 > a:not([href^="http"])').to_a.index(at_css('.toctree-l1.current > a')) + 1}. " + end + name.remove! "\u{00B6}" + name + end + + def get_type + if subpath.start_with?('generated') || (subpath.include?('reference') && !subpath.include?('reference/index')) + css('.toctree-l2.current > a').last.content.remove(/\s\(.+?\)/) + else + 'Manual' + end + end + end + end +end diff --git a/lib/docs/scrapers/pandas.rb b/lib/docs/scrapers/pandas.rb index fedba47b..99f31e25 100644 --- a/lib/docs/scrapers/pandas.rb +++ b/lib/docs/scrapers/pandas.rb @@ -4,61 +4,117 @@ module Docs self.type = 'sphinx' self.root_path = 'index.html' self.links = { - home: 'http://pandas.pydata.org/', + home: 'https://pandas.pydata.org/', code: 'https://github.com/pydata/pandas' } - html_filters.push 'pandas/entries', 'pandas/clean_html', 'sphinx/clean_html' - - # Cannot take only the body, as the sidebar gives info about the type. - options[:container] = '.document' + html_filters.push 'pandas/clean_html', 'pandas/entries' options[:skip] = %w(internals.html release.html contributing.html whatsnew.html) options[:skip_patterns] = [/whatsnew\//] options[:attribution] = <<-HTML - © 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
+ © 2008–2020, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License. HTML + version '1' do + self.release = '1.1.4' + self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/" + + html_filters.push 'pandas/clean_html', 'pandas/entries' + + options[:skip_patterns] = [ + /development/, + /getting_started/, + /whatsnew/ + ] + + options[:skip] = [ + 'panel.html', + 'pandas.pdf', + 'pandas.zip', + 'ecosystem.html' + ] + + end + version '0.25' do self.release = '0.25.0' self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/" + + html_filters.push 'pandas/entries_old', 'pandas/clean_html_old', 'sphinx/clean_html' + + options[:container] = '.document' + end version '0.24' do self.release = '0.24.2' self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/" + + html_filters.push 'pandas/entries_old', 'pandas/clean_html_old', 'sphinx/clean_html' + options[:container] = '.document' + end version '0.23' do self.release = '0.23.4' self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/" + + html_filters.push 'pandas/entries_old', 'pandas/clean_html_old', 'sphinx/clean_html' + options[:container] = '.document' + end version '0.22' do self.release = '0.22.0' self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/" + + html_filters.push 'pandas/entries_old', 'pandas/clean_html_old', 'sphinx/clean_html' + + options[:container] = '.document' + end version '0.21' do self.release = '0.21.1' self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/" + + html_filters.push 'pandas/entries_old', 'pandas/clean_html_old', 'sphinx/clean_html' + + options[:container] = '.document' + end version '0.20' do self.release = '0.20.3' self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/" + + html_filters.push 'pandas/entries_old', 'pandas/clean_html_old', 'sphinx/clean_html' + + options[:container] = '.document' + end version '0.19' do self.release = '0.19.2' self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/" + + html_filters.push 'pandas/entries_old', 'pandas/clean_html_old', 'sphinx/clean_html' + + options[:container] = '.document' + end version '0.18' do self.release = '0.18.1' self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/" + + html_filters.push 'pandas/entries_old', 'pandas/clean_html_old', 'sphinx/clean_html' + + options[:container] = '.document' + end def get_latest_version(opts) diff --git a/public/icons/docs/pandas/16.png b/public/icons/docs/pandas/16.png index cdc075ef..24a421fb 100644 Binary files a/public/icons/docs/pandas/16.png and b/public/icons/docs/pandas/16.png differ diff --git a/public/icons/docs/pandas/16@2x.png b/public/icons/docs/pandas/16@2x.png index ef9a0e29..b9d3bd45 100644 Binary files a/public/icons/docs/pandas/16@2x.png and b/public/icons/docs/pandas/16@2x.png differ diff --git a/public/icons/docs/pandas/SOURCE b/public/icons/docs/pandas/SOURCE index b19b45d3..40788c5f 100644 --- a/public/icons/docs/pandas/SOURCE +++ b/public/icons/docs/pandas/SOURCE @@ -1 +1 @@ -http://pandas.pydata.org/_static/pandas_logo.png \ No newline at end of file +https://commons.wikimedia.org/wiki/File:Pandas_mark.svg \ No newline at end of file