mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Closes #1020: ext.todo todolist not linking to the page in pdflatex
This commit is contained in:
parent
08f6f7ba4d
commit
ed4949e000
1
AUTHORS
1
AUTHORS
@ -29,6 +29,7 @@ Other contributors, listed alphabetically, are:
|
||||
* Kevin Dunn -- MathJax extension
|
||||
* Josip Dzolonga -- coverage builder
|
||||
* Buck Evan -- dummy builder
|
||||
* Matthew Fernandez -- todo extension fix
|
||||
* Hernan Grecco -- search improvements
|
||||
* Horst Gutmann -- internationalization support
|
||||
* Martin Hans -- autodoc improvements
|
||||
|
1
CHANGES
1
CHANGES
@ -31,6 +31,7 @@ Bugs fixed
|
||||
* #3692: Unable to build HTML if writing .buildinfo failed
|
||||
* #4152: HTML writer crashes if a field list is placed on top of the document
|
||||
* #4063: Sphinx crashes when labeling directive ``.. todolist::``
|
||||
* #1020: ext.todo todolist not linking to the page in pdflatex
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
@ -69,6 +69,8 @@ class Todo(BaseAdmonition):
|
||||
|
||||
env = self.state.document.settings.env
|
||||
targetid = 'index-%s' % env.new_serialno('index')
|
||||
# Stash the target to be retrieved later in latex_visit_todo_node.
|
||||
todo['targetref'] = '%s:%s' % (env.docname, targetid)
|
||||
targetnode = nodes.target('', '', ids=[targetid])
|
||||
return [targetnode, todo]
|
||||
|
||||
@ -173,8 +175,12 @@ def process_todo_nodes(app, doctree, fromdocname):
|
||||
para += newnode
|
||||
para += nodes.Text(desc2, desc2)
|
||||
|
||||
# (Recursively) resolve references in the todo content
|
||||
todo_entry = todo_info['todo']
|
||||
# Remove targetref from the (copied) node to avoid emitting a
|
||||
# duplicate label of the original entry when we walk this node.
|
||||
del todo_entry['targetref']
|
||||
|
||||
# (Recursively) resolve references in the todo content
|
||||
env.resolve_references(todo_entry, todo_info['docname'],
|
||||
app.builder)
|
||||
|
||||
@ -216,7 +222,13 @@ def depart_todo_node(self, node):
|
||||
def latex_visit_todo_node(self, node):
|
||||
# type: (nodes.NodeVisitor, todo_node) -> None
|
||||
title = node.pop(0).astext().translate(tex_escape_map)
|
||||
self.body.append(u'\n\\begin{sphinxadmonition}{note}{%s:}' % title)
|
||||
self.body.append(u'\n\\begin{sphinxadmonition}{note}{')
|
||||
# If this is the original todo node, emit a label that will be referenced by
|
||||
# a hyperref in the todolist.
|
||||
target = node.get('targetref')
|
||||
if target is not None:
|
||||
self.body.append(u'\\label{%s}' % target)
|
||||
self.body.append('%s:}' % title)
|
||||
|
||||
|
||||
def latex_depart_todo_node(self, node):
|
||||
|
Loading…
Reference in New Issue
Block a user