mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
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:
parent
6d89feae1e
commit
3204f83dc7
@ -97,6 +97,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
sectionnames = ["part", "chapter", "section", "subsection",
|
sectionnames = ["part", "chapter", "section", "subsection",
|
||||||
"subsubsection", "paragraph", "subparagraph"]
|
"subsubsection", "paragraph", "subparagraph"]
|
||||||
|
|
||||||
|
ignore_missing_images = False
|
||||||
|
|
||||||
def __init__(self, document, builder):
|
def __init__(self, document, builder):
|
||||||
nodes.NodeVisitor.__init__(self, document)
|
nodes.NodeVisitor.__init__(self, document)
|
||||||
self.builder = builder
|
self.builder = builder
|
||||||
@ -665,6 +667,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
if node['uri'] in self.builder.images:
|
if node['uri'] in self.builder.images:
|
||||||
uri = self.builder.images[node['uri']]
|
uri = self.builder.images[node['uri']]
|
||||||
else:
|
else:
|
||||||
|
# missing image!
|
||||||
|
if self.ignore_missing_images:
|
||||||
|
return
|
||||||
uri = node['uri']
|
uri = node['uri']
|
||||||
if uri.find('://') != -1:
|
if uri.find('://') != -1:
|
||||||
# ignore remote images
|
# ignore remote images
|
||||||
|
@ -18,14 +18,14 @@ Admonitions
|
|||||||
|
|
||||||
Warning text.
|
Warning text.
|
||||||
|
|
||||||
.. tip:
|
.. tip::
|
||||||
Tip text.
|
Tip text.
|
||||||
|
|
||||||
|
|
||||||
Tables
|
Tables
|
||||||
------
|
------
|
||||||
|
|
||||||
.. tabularcolumns:: |L|L|R|
|
.. tabularcolumns:: |L|p{5cm}|R|
|
||||||
|
|
||||||
+----+----------------+----+
|
+----+----------------+----+
|
||||||
| 1 | * Block elems | x |
|
| 1 | * Block elems | x |
|
||||||
@ -42,7 +42,7 @@ Version markup
|
|||||||
Some funny **stuff**.
|
Some funny **stuff**.
|
||||||
|
|
||||||
.. versionchanged:: 0.5
|
.. versionchanged:: 0.5
|
||||||
Even more funny stuff. [#]_
|
Even more funny stuff.
|
||||||
|
|
||||||
.. deprecated:: 0.4
|
.. deprecated:: 0.4
|
||||||
Boring stuff.
|
Boring stuff.
|
||||||
@ -51,6 +51,8 @@ Version markup
|
|||||||
Misc stuff
|
Misc stuff
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
Stuff [#]_
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
`Google <http://www.google.com>`_
|
`Google <http://www.google.com>`_
|
||||||
|
@ -13,11 +13,13 @@ import os
|
|||||||
import difflib
|
import difflib
|
||||||
import htmlentitydefs
|
import htmlentitydefs
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
|
from subprocess import Popen, PIPE
|
||||||
|
|
||||||
from util import *
|
from util import *
|
||||||
from etree13 import ElementTree as ET
|
from etree13 import ElementTree as ET
|
||||||
|
|
||||||
from sphinx.builder import StandaloneHTMLBuilder, LaTeXBuilder
|
from sphinx.builder import StandaloneHTMLBuilder, LaTeXBuilder
|
||||||
|
from sphinx.latexwriter import LaTeXTranslator
|
||||||
|
|
||||||
|
|
||||||
html_warnfile = StringIO()
|
html_warnfile = StringIO()
|
||||||
@ -94,6 +96,7 @@ def test_html(app):
|
|||||||
|
|
||||||
@with_testapp(buildername='latex', warning=latex_warnfile)
|
@with_testapp(buildername='latex', warning=latex_warnfile)
|
||||||
def test_latex(app):
|
def test_latex(app):
|
||||||
|
LaTeXTranslator.ignore_missing_images = True
|
||||||
app.builder.build_all()
|
app.builder.build_all()
|
||||||
latex_warnings = latex_warnfile.getvalue().replace(os.sep, '/')
|
latex_warnings = latex_warnfile.getvalue().replace(os.sep, '/')
|
||||||
latex_warnings_exp = LATEX_WARNINGS % {'root': app.srcdir}
|
latex_warnings_exp = LATEX_WARNINGS % {'root': app.srcdir}
|
||||||
@ -101,6 +104,23 @@ def test_latex(app):
|
|||||||
'\n'.join(difflib.ndiff(latex_warnings_exp.splitlines(),
|
'\n'.join(difflib.ndiff(latex_warnings_exp.splitlines(),
|
||||||
latex_warnings.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
|
# just let the remaining ones run for now
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user