|
17 | 17 | import cPickle |
18 | 18 | import re |
19 | 19 | import urllib2 |
| 20 | +import gzip |
20 | 21 |
|
21 | 22 | try: |
22 | 23 | from PIL import Image |
@@ -113,7 +114,17 @@ def __init__(self, doc_pages_url, extra_modules_test=None): |
113 | 114 | for url in doc_pages_url: |
114 | 115 | try: |
115 | 116 | resp = urllib2.urlopen(url) |
116 | | - html = resp.read() |
| 117 | + encoding = resp.headers.dict.get('content-encoding', 'plain') |
| 118 | + data = resp.read() |
| 119 | + if encoding == 'plain': |
| 120 | + html = resp.read() |
| 121 | + elif encoding == 'gzip': |
| 122 | + data = StringIO(data) |
| 123 | + html = gzip.GzipFile(fileobj=data).read() |
| 124 | + else: |
| 125 | + print '%s has unknown encoding %s' % (url, encoding) |
| 126 | + html = '' |
| 127 | + |
117 | 128 | doc_pages_html.append(html) |
118 | 129 | except urllib2.HTTPError: |
119 | 130 | print 'error when retrieving %s' % url |
@@ -601,7 +612,33 @@ def embed_code_links(app, exception): |
601 | 612 |
|
602 | 613 | # matplotlib and mayavi document several items on the same page |
603 | 614 | doc_resolvers['matplotlib'] = SinglePageDocLinkResolver( |
604 | | - ['http://matplotlib.org/api/pyplot_api.html']) |
| 615 | + ['http://matplotlib.org/api/animation_api.html', |
| 616 | + 'http://matplotlib.org/api/artist_api.html', |
| 617 | + 'http://matplotlib.org/api/axes_api.html', |
| 618 | + 'http://matplotlib.org/api/axis_api.html', |
| 619 | + 'http://matplotlib.org/api/index_backend_api.html', |
| 620 | + 'http://matplotlib.org/api/cbook_api.html', |
| 621 | + 'http://matplotlib.org/api/cm_api.html', |
| 622 | + 'http://matplotlib.org/api/collections_api.html', |
| 623 | + 'http://matplotlib.org/api/colorbar_api.html', |
| 624 | + 'http://matplotlib.org/api/colors_api.html', |
| 625 | + 'http://matplotlib.org/api/dates_api.html', |
| 626 | + 'http://matplotlib.org/api/figure_api.html', |
| 627 | + 'http://matplotlib.org/api/font_manager_api.html', |
| 628 | + 'http://matplotlib.org/api/gridspec_api.html', |
| 629 | + 'http://matplotlib.org/api/legend_api.html', |
| 630 | + 'http://matplotlib.org/api/mathtext_api.html', |
| 631 | + 'http://matplotlib.org/api/mlab_api.html', |
| 632 | + 'http://matplotlib.org/api/nxutils_api.html', |
| 633 | + 'http://matplotlib.org/api/path_api.html', |
| 634 | + 'http://matplotlib.org/api/pyplot_api.html', |
| 635 | + 'http://matplotlib.org/api/sankey_api.html', |
| 636 | + 'http://matplotlib.org/api/spines_api.html', |
| 637 | + 'http://matplotlib.org/api/ticker_api.html', |
| 638 | + 'http://matplotlib.org/api/tight_layout_api.html', |
| 639 | + 'http://matplotlib.org/api/units_api.html', |
| 640 | + 'http://matplotlib.org/api/widgets_api.html', |
| 641 | + 'http://matplotlib.org/api/pyplot_api.html']) |
605 | 642 |
|
606 | 643 | mayavi_base = 'http://docs.enthought.com/mayavi/mayavi/auto/' |
607 | 644 | doc_resolvers['mayavi'] = SinglePageDocLinkResolver( |
|
0 commit comments