Skip to content

Commit 718fa99

Browse files
japborstThibaut
authored andcommitted
Matplotlib toolkits support
1 parent 79a2025 commit 718fa99

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

lib/docs/filters/matplotlib/entries.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ def get_name
1515
name = at_css('h1').content.strip
1616
name.remove! "\u{00b6}"
1717
name.remove! 'matplotlib.'
18+
name.remove! 'mpl_toolkits.'
19+
name.remove! ' API'
1820
name.remove! %r{ \(.*\)}
1921
name.downcase!
2022
name
@@ -29,17 +31,20 @@ def additional_entries
2931
entries = []
3032

3133
css('.class > dt[id]', '.exception > dt[id]', '.attribute > dt[id]').each do |node|
32-
entries << [node['id'].remove('matplotlib.'), node['id']]
34+
entry_name = node['id'].remove('matplotlib.').remove('mpl_toolkits.')
35+
entries << [entry_name, node['id']]
3336
end
3437

3538
css('.data > dt[id]').each do |node|
3639
if node['id'].split('.').last.upcase! # skip constants
37-
entries << [node['id'].remove('matplotlib.'), node['id']]
40+
entry_name = node['id'].remove('matplotlib.').remove('mpl_toolkits.')
41+
entries << [entry_name, node['id']]
3842
end
3943
end
4044

4145
css('.function > dt[id]', '.method > dt[id]', '.classmethod > dt[id]').each do |node|
42-
entries << [node['id'].remove('matplotlib.') + '()', node['id']]
46+
entry_name = node['id'].remove('matplotlib.').remove('mpl_toolkits.')
47+
entries << [entry_name + '()', node['id']]
4348
end
4449

4550
entries

lib/docs/scrapers/matplotlib.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
module Docs
22
class Matplotlib < UrlScraper
3+
include MultipleBaseUrls
4+
35
self.name = 'Matplotlib'
46
self.type = 'sphinx'
57
self.root_path = 'index.html'
@@ -11,7 +13,7 @@ class Matplotlib < UrlScraper
1113
html_filters.push 'matplotlib/entries', 'sphinx/clean_html'
1214

1315
options[:container] = '.body'
14-
options[:skip] = %w(api_changes.html)
16+
options[:skip] = %w(api_changes.html tutorial.html faq.html)
1517

1618
options[:attribution] = <<-HTML
1719
&copy; 2012&ndash;2016 Matplotlib Development Team. All rights reserved.<br>
@@ -20,7 +22,11 @@ class Matplotlib < UrlScraper
2022

2123
version '1.5' do
2224
self.release = '1.5.1'
23-
self.base_url = 'http://matplotlib.org/1.5.1/api/'
25+
self.base_urls = [
26+
'http://matplotlib.org/1.5.1/api/',
27+
'http://matplotlib.org/1.5.1/mpl_toolkits/mplot3d/',
28+
'http://matplotlib.org/1.5.1/mpl_toolkits/axes_grid/api/'
29+
]
2430
end
2531
end
2632
end

0 commit comments

Comments
 (0)