Skip to content

Commit 0e160aa

Browse files
Martin Luessiamueller
authored andcommitted
gzip support, whats_new
1 parent e1b583e commit 0e160aa

File tree

2 files changed

+53
-2
lines changed

2 files changed

+53
-2
lines changed

doc/sphinxext/gen_rst.py

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import cPickle
1818
import re
1919
import urllib2
20+
import gzip
2021

2122
try:
2223
from PIL import Image
@@ -113,7 +114,17 @@ def __init__(self, doc_pages_url, extra_modules_test=None):
113114
for url in doc_pages_url:
114115
try:
115116
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+
117128
doc_pages_html.append(html)
118129
except urllib2.HTTPError:
119130
print 'error when retrieving %s' % url
@@ -601,7 +612,33 @@ def embed_code_links(app, exception):
601612

602613
# matplotlib and mayavi document several items on the same page
603614
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'])
605642

606643
mayavi_base = 'http://docs.enthought.com/mayavi/mayavi/auto/'
607644
doc_resolvers['mayavi'] = SinglePageDocLinkResolver(

doc/whats_new.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
.. currentmodule:: sklearn
22

3+
.. _changes_0_14:
4+
5+
0.14
6+
====
7+
8+
Changelog
9+
---------
10+
11+
- Hyperlinks to documentation in example code on the website by
12+
`Martin Luessi`_.
13+
14+
315
.. _changes_0_13:
416

517
0.13
@@ -1763,3 +1775,5 @@ David Huard, Dave Morrill, Ed Schofield, Travis Oliphant, Pearu Peterson.
17631775
.. _Arnaud Joly: http://www.ajoly.org
17641776

17651777
.. _Rob Zinkov: http://zinkov.com
1778+
1779+
.. _Martin Luessi: https://github.com/mluessi

0 commit comments

Comments
 (0)