Fix handling of "docname" and target names in LaTeX builder.

This commit is contained in:
Georg Brandl 2009-02-14 11:38:28 +01:00
parent c09bf1ad85
commit 012e7f2d79
2 changed files with 13 additions and 9 deletions

View File

@ -52,6 +52,10 @@ class LaTeXBuilder(Builder):
else:
return '%' + docname
def get_relative_uri(self, from_, to, typ=None):
# ignore source path
return self.get_target_uri(to, typ)
def init_document_data(self):
preliminary_document_data = map(list, self.config.latex_documents)
if not preliminary_document_data:
@ -72,11 +76,6 @@ class LaTeXBuilder(Builder):
self.titles.append((docname, entry[2]))
def write(self, *ignored):
# first, assemble the "appendix" docs that are in every PDF
appendices = []
for fname in self.config.latex_appendices:
appendices.append(self.env.get_doctree(fname))
docwriter = LaTeXWriter(self)
docsettings = OptionParser(
defaults=self.env.settings,
@ -94,7 +93,8 @@ class LaTeXBuilder(Builder):
encoding='utf-8')
self.info("processing " + targetname + "... ", nonl=1)
doctree = self.assemble_doctree(docname, toctree_only,
appendices=(docclass == 'manual') and appendices or [])
appendices=((docclass == 'manual') and
self.config.latex_appendices or []))
self.post_process_images(doctree)
self.info("writing... ", nonl=1)
doctree.settings = docsettings
@ -140,7 +140,11 @@ class LaTeXBuilder(Builder):
new_sect += node
tree = new_tree
largetree = process_tree(indexfile, tree)
largetree.extend(appendices)
largetree['docname'] = indexfile
for docname in appendices:
appendix = self.env.get_doctree(docname)
appendix['docname'] = docname
largetree.append(appendix)
self.info()
self.info("resolving references...")
self.env.resolve_references(largetree, indexfile, self)

View File

@ -239,7 +239,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
def visit_document(self, node):
self.footnotestack.append(self.collect_footnotes(node))
self.curfilestack.append(node['file'])
self.curfilestack.append(node['docname'])
if self.first_document == 1:
# the first document is all the regular content ...
self.body.append(BEGIN_DOC % self.elements)
@ -274,7 +274,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.footnotestack.append(self.collect_footnotes(node))
# also add a document target
self.body.append('\\hypertarget{--doc-%s}{}' % node['docname'])
self.curfilestack.append(node['file'])
self.curfilestack.append(node['docname'])
def collect_footnotes(self, node):
fnotes = {}