Merged revisions 65556 via svnmerge from

svn+ssh://pythondev@svn.python.org/doctools/branches/0.4.x

........
  r65556 | georg.brandl | 2008-08-06 15:12:43 +0000 (Wed, 06 Aug 2008) | 2 lines

  Run latex over the latex builder's output.
........
This commit is contained in:
Georg Brandl 2008-08-06 15:13:42 +00:00
parent 6d89feae1e
commit 3204f83dc7
3 changed files with 30 additions and 3 deletions

View File

@ -97,6 +97,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
sectionnames = ["part", "chapter", "section", "subsection",
"subsubsection", "paragraph", "subparagraph"]
ignore_missing_images = False
def __init__(self, document, builder):
nodes.NodeVisitor.__init__(self, document)
self.builder = builder
@ -665,6 +667,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
if node['uri'] in self.builder.images:
uri = self.builder.images[node['uri']]
else:
# missing image!
if self.ignore_missing_images:
return
uri = node['uri']
if uri.find('://') != -1:
# ignore remote images

View File

@ -18,14 +18,14 @@ Admonitions
Warning text.
.. tip:
.. tip::
Tip text.
Tables
------
.. tabularcolumns:: |L|L|R|
.. tabularcolumns:: |L|p{5cm}|R|
+----+----------------+----+
| 1 | * Block elems | x |
@ -42,7 +42,7 @@ Version markup
Some funny **stuff**.
.. versionchanged:: 0.5
Even more funny stuff. [#]_
Even more funny stuff.
.. deprecated:: 0.4
Boring stuff.
@ -51,6 +51,8 @@ Version markup
Misc stuff
----------
Stuff [#]_
.. seealso::
`Google <http://www.google.com>`_

View File

@ -13,11 +13,13 @@ import os
import difflib
import htmlentitydefs
from StringIO import StringIO
from subprocess import Popen, PIPE
from util import *
from etree13 import ElementTree as ET
from sphinx.builder import StandaloneHTMLBuilder, LaTeXBuilder
from sphinx.latexwriter import LaTeXTranslator
html_warnfile = StringIO()
@ -94,6 +96,7 @@ def test_html(app):
@with_testapp(buildername='latex', warning=latex_warnfile)
def test_latex(app):
LaTeXTranslator.ignore_missing_images = True
app.builder.build_all()
latex_warnings = latex_warnfile.getvalue().replace(os.sep, '/')
latex_warnings_exp = LATEX_WARNINGS % {'root': app.srcdir}
@ -101,6 +104,23 @@ def test_latex(app):
'\n'.join(difflib.ndiff(latex_warnings_exp.splitlines(),
latex_warnings.splitlines()))
# now, try to run latex over it
cwd = os.getcwd()
os.chdir(app.outdir)
try:
try:
p = Popen(['pdflatex', '--interaction=nonstopmode', 'SphinxTests.tex'],
stdout=PIPE, stderr=PIPE)
except OSError, err:
pass # most likely pdflatex was not found
else:
stdout, stderr = p.communicate()
if p.returncode != 0:
print stdout
del app.cleanup_trees[:]
assert False, 'latex exited with error'
finally:
os.chdir(cwd)
# just let the remaining ones run for now