##// END OF EJS Templates
handle exit in `ipython console`
handle exit in `ipython console`

File last commit:

r4208:b4b4ede0
r5632:12053829
Show More
do_sphinx.py
78 lines | 2.2 KiB | text/x-python | PythonLexer
Fernando Perez
Fixes to build/doc scripts.
r1206 #!/usr/bin/env python
"""Script to build documentation using Sphinx.
"""
vivainio2
sphinx: improve pdf rendering
r1170 import fileinput,os,sys
Ville M. Vainio
do_sphinx: implement pdf creation (for non-windows platforms)
r1167
Ville M. Vainio
add do_sphinx.py
r1118 def oscmd(c):
Ville M. Vainio
do_sphinx: implement pdf creation (for non-windows platforms)
r1167 os.system(c)
vivainio2
sphinx: improve pdf rendering
r1170 # html manual.
Ville M. Vainio
do_sphinx: implement pdf creation (for non-windows platforms)
r1167 oscmd('sphinx-build -d build/doctrees source build/html')
if sys.platform != 'win32':
vivainio2
sphinx: improve pdf rendering
r1170 # LaTeX format.
Ville M. Vainio
do_sphinx: implement pdf creation (for non-windows platforms)
r1167 oscmd('sphinx-build -b latex -d build/doctrees source build/latex')
vivainio2
sphinx: improve pdf rendering
r1170
# Produce pdf.
Jörgen Stenarson
Search of getcwd and replace with getcwdu. Ignoring core/prompts.py
r4208 topdir = os.getcwdu()
Ville M. Vainio
do_sphinx: implement pdf creation (for non-windows platforms)
r1167 os.chdir('build/latex')
vivainio2
sphinx: improve pdf rendering
r1170
Eric Firing
Fix doc build with newer versions of sphinx.
r3898 # Change chapter style to section style: allows chapters to start on
Ville M. Vainio
docs: new changes by james spencer to improve pdf doc style....
r1185 # the current page. Works much better for the short chapters we have.
Eric Firing
Fix doc build with newer versions of sphinx.
r3898 # This must go in the class file rather than the preamble, so we modify
Ville M. Vainio
docs: new changes by james spencer to improve pdf doc style....
r1185 # manual.cls at runtime.
chapter_cmds=r'''
% Local changes.
\renewcommand\chapter{
\thispagestyle{plain}
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter
}
\def\@makechapterhead#1{
\vspace*{10\p@}
{\raggedright \reset@font \Huge \bfseries \thechapter \quad #1}
\par\nobreak
\hrulefill
\par\nobreak
\vspace*{10\p@}
}
\def\@makeschapterhead#1{
\vspace*{10\p@}
{\raggedright \reset@font \Huge \bfseries #1}
\par\nobreak
\hrulefill
\par\nobreak
\vspace*{10\p@}
}
'''
Eric Firing
Fix doc build with newer versions of sphinx.
r3898 # manual.cls in Sphinx <= 0.6.7 became sphinxmanual.cls for 1.x
manualcls = 'sphinxmanual.cls'
if not os.path.exists(manualcls):
manualcls = 'manual.cls'
Ville M. Vainio
docs: new changes by james spencer to improve pdf doc style....
r1185
unmodified=True
Eric Firing
Fix doc build with newer versions of sphinx.
r3898 for line in fileinput.FileInput(manualcls, inplace=True):
Ville M. Vainio
docs: new changes by james spencer to improve pdf doc style....
r1185 if 'Support for module synopsis' in line and unmodified:
line=chapter_cmds+line
elif 'makechapterhead' in line:
# Already have altered manual.cls: don't need to again.
unmodified=False
vivainio2
sphinx: improve pdf rendering
r1170 print line,
# Copying the makefile produced by sphinx...
Ville M. Vainio
do_sphinx: implement pdf creation (for non-windows platforms)
r1167 oscmd('pdflatex ipython.tex')
oscmd('pdflatex ipython.tex')
oscmd('pdflatex ipython.tex')
oscmd('makeindex -s python.ist ipython.idx')
oscmd('makeindex -s python.ist modipython.idx')
oscmd('pdflatex ipython.tex')
oscmd('pdflatex ipython.tex')
Fernando Perez
Fixes to build/doc scripts.
r1206
# Create a manual/ directory with final html/pdf output
os.chdir(topdir)
oscmd('rm -rf manual')
oscmd('mkdir manual')
oscmd('cp -r build/html/*.html build/html/_static manual/')
oscmd('cp build/latex/ipython.pdf manual/')