Commit 3532c472 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Generate the PDF version of the documentation.

parent a50e5117
......@@ -51,7 +51,9 @@ EXTJSSRC = 'static/plugin_extjs/src'
JSDOC = 'static/docs/jsduck'
JSLIBMIN = 'static/%s-min.js' % APP
JSLIBSRC = 'static/src'
LATEXDOC = 'static/docs/latex'
PYDOC = 'static/docs/epydoc'
PDFDOC = 'static/docs/pdf'
SPHINXDOC = 'static/docs/sphinx'
SPHINXSRC = 'documentations/userguide/'
......@@ -60,6 +62,7 @@ NOW = datetime.datetime.now()
# basic commands
JSDUCK = os.path.expandvars("$HOME/bin/jsduck")
GIT = '/usr/bin/git'
PDFLATEX = '/usr/bin/pdflatex'
SENCHA = os.path.expandvars("$HOME/bin/sencha")
SPHINX = '/usr/bin/sphinx-build'
......@@ -257,15 +260,57 @@ def sphinx():
print '\tSkip this step.\n'
return
print 1, SPHINXSRC
if not os.path.exists(SPHINXSRC):
return
# generate the HTML version
cmd = [SPHINX, "-b", "html", SPHINXSRC, SPHINXDOC]
print 2, cmd
subprocess.call(cmd)
print "\nSphinx HTML documentation in", SPHINXDOC,"\n"
print "Sphinx documentation in", SPHINXDOC
# generate the PDF version
if not os.path.exists(PDFLATEX):
print '\n\tThe application pdflatex is missing !'
print '\tSkip this step.\n'
return
rep = raw_input("Produce the sphinx pdf (y/N) [n]:")
if not rep.lower().startswith("y"):
return
if not os.path.exists(PDFDOC):
os.makedirs(PDFDOC)
# generate the latex
cmd = [SPHINX, "-b", "latex", SPHINXSRC, LATEXDOC]
subprocess.call(cmd)
# find the tex file
cwd = os.getcwd()
os.chdir(LATEXDOC)
li = [el for el in os.listdir('.') if el.endswith('.tex')]
fn = (li[0] if len(li) == 1 else None)
if fn:
pdf = fn.replace('.tex', '.pdf')
cmd = [PDFLATEX, "-output-directory", "../pdf", fn]
# run pdflatex twice to get reference right
subprocess.call(cmd)
subprocess.call(cmd)
# clean the pdf directory
os.chdir(cwd)
for el in os.listdir(PDFDOC):
if el.endswith('.pdf'):
continue
os.remove(os.path.join(PDFDOC, el))
cmd = ["rm", "-rf", LATEXDOC]
subprocess.call(cmd)
print "\nSphinx PDF documentation in", PDFDOC,"\n"
if __name__ == '__main__':
......
......@@ -187,7 +187,7 @@ latex_elements = {
'papersize': 'a4paper',
# The font size ('10pt', '11pt' or '12pt').
'pointsize': '11pt',
'pointsize': '12pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
......
......@@ -5,9 +5,13 @@
</p>
<ul>
<li class="dbui-p">
{{=T("User guides")}} (
<a href="/{{=request.application}}/static/docs/sphinx/index.html" target="_blank">
{{=T("User guides")}}
</a>
html
</a>,
<a href="/{{=request.application}}/static/docs/pdf/track_events.pdf" target="_blank">
pdf
</a>)
</li>
<li class="dbui-p">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment