8000 Merge pull request #3325 from cgohlke/patch-1 · matplotlib/matplotlib@939b5be · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 939b5be

Browse files
committed
Merge pull request #3325 from cgohlke/patch-1
ENH: add HTML Help builder option
2 parents 6220698 + db09a71 commit 939b5be

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

doc/make.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import os
77
import shutil
88
import sys
9+
import re
910

1011
### Begin compatibility block for pre-v2.6: ###
1112
#
@@ -135,21 +136,32 @@ def doctest():
135136
def linkcheck():
136137
os.system('sphinx-build -b linkcheck -d build/doctrees . build/linkcheck')
137138

138-
def html():
139+
def html(buildername='html'):
139140
check_build()
140141
copy_if_out_of_date('../lib/matplotlib/mpl-data/matplotlibrc', '_static/matplotlibrc')
141142
if small_docs:
142143
options = "-D plot_formats=\"[('png', 80)]\""
143144
else:
144145
options = ''
145-
if os.system('sphinx-build %s -b html -d build/doctrees . build/html' % options):
146+
if os.system('sphinx-build %s -b %s -d build/doctrees . build/%s' % (options, buildername, buildername)):
146147
raise SystemExit("Building HTML failed.")
147148

148149
# Clean out PDF files from the _images directory
149-
for filename in glob.glob('build/html/_images/*.pdf'):
150+
for filename in glob.glob('build/%s/_images/*.pdf' % buildername):
150151
os.remove(filename)
151152

152-
shutil.copy('../CHANGELOG', 'build/html/_static/CHANGELOG')
153+
shutil.copy('../CHANGELOG', 'build/%s/_static/CHANGELOG' % buildername)
154+
155+
def htmlhelp():
156+
html(buildername='htmlhelp')
157+
# remove scripts from index.html
158+
with open('build/htmlhelp/index.html', 'r+') as fh:
159+
content = fh.read()
160+
fh.seek(0)
161+
content = re.sub(r'<script>.*?</script>', '', content,
162+
flags=re.MULTILINE| re.DOTALL)
163+
fh.write(content)
164+
fh.truncate()
153165

154166
def latex():
155167
check_build()
@@ -213,6 +225,7 @@ def all():
213225

214226
funcd = {
215227
'html' : html,
228+
'htmlhelp' : htmlhelp,
216229
'latex' : latex,
217230
'texinfo' : texinfo,
218231
'clean' : clean,

doc/sphinxext/gen_gallery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def out_of_date(original, derived):
6161

6262

6363
def gen_gallery(app, doctree):
64-
if app.builder.name != 'html':
64+
if app.builder.name not in ('html', 'htmlhelp'):
6565
return
6666

6767
outdir = app.builder.outdir

0 commit comments

Comments
 (0)
0