mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
commit
f5eb47fadf
9 changed files with 153 additions and 31 deletions
|
@ -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'
|
||||
], [
|
||||
|
|
|
@ -2,17 +2,34 @@ 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'
|
||||
css('img').remove
|
||||
end
|
||||
|
||||
css('h2 > a.reference', 'h3 > a.reference').each do |node|
|
||||
node.before(node.children).remove
|
||||
css('#navbar-main').remove
|
||||
|
||||
css('form').remove
|
||||
|
||||
# add ':' to '.classifier' clases
|
||||
css('.classifier').each do |node|
|
||||
text = node.content
|
||||
node.content = ':' + text
|
||||
node.content = node.content.gsub(/::/, ' : ')
|
||||
end
|
||||
|
||||
# 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
|
||||
end
|
||||
|
|
20
lib/docs/filters/pandas/clean_html_old.rb
Normal file
20
lib/docs/filters/pandas/clean_html_old.rb
Normal file
|
@ -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
|
|
@ -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
|
||||
|
|
29
lib/docs/filters/pandas/entries_old.rb
Normal file
29
lib/docs/filters/pandas/entries_old.rb
Normal file
|
@ -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
|
|
@ -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<br>
|
||||
© 2008–2020, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team<br>
|
||||
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)
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 324 B After Width: | Height: | Size: 794 B |
Binary file not shown.
Before Width: | Height: | Size: 441 B After Width: | Height: | Size: 1.3 KiB |
|
@ -1 +1 @@
|
|||
http://pandas.pydata.org/_static/pandas_logo.png
|
||||
https://commons.wikimedia.org/wiki/File:Pandas_mark.svg
|
Loading…
Reference in a new issue