Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions doc/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
import shutil
import sys
import re

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

def html():
def html(buildername='html'):
check_build()
copy_if_out_of_date('../lib/matplotlib/mpl-data/matplotlibrc', '_static/matplotlibrc')
if small_docs:
options = "-D plot_formats=\"[('png', 80)]\""
else:
options = ''
if os.system('sphinx-build %s -b html -d build/doctrees . build/html' % options):
if os.system('sphinx-build %s -b %s -d build/doctrees . build/%s' % (options, buildername, buildername)):
raise SystemExit("Building HTML failed.")

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

shutil.copy('../CHANGELOG', 'build/html/_static/CHANGELOG')
shutil.copy('../CHANGELOG', 'build/%s/_static/CHANGELOG' % buildername)

def htmlhelp():
html(buildername='htmlhelp')
# remove scripts from index.html
with open('build/htmlhelp/index.html', 'r+') as fh:
content = fh.read()
fh.seek(0)
content = re.sub(r'<script>.*?</script>', '', content,
flags=re.MULTILINE| re.DOTALL)
fh.write(content)
fh.truncate()

def latex():
check_build()
Expand Down Expand Up @@ -213,6 +225,7 @@ def all():

funcd = {
'html' : html,
'htmlhelp' : htmlhelp,
'latex' : latex,
'texinfo' : texinfo,
'clean' : clean,
Expand Down
2 changes: 1 addition & 1 deletion doc/sphinxext/gen_gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def out_of_date(original, derived):


def gen_gallery(app, doctree):
if app.builder.name != 'html':
if app.builder.name not in ('html', 'htmlhelp'):
return

outdir = app.builder.outdir
Expand Down