mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
refactor: todo: Skip over todo_node on writing handlers (not removal)
This commit is contained in:
parent
ef4ad32025
commit
0441ab0350
@ -124,13 +124,9 @@ class TodoList(SphinxDirective):
|
|||||||
|
|
||||||
def process_todo_nodes(app, doctree, fromdocname):
|
def process_todo_nodes(app, doctree, fromdocname):
|
||||||
# type: (Sphinx, nodes.document, str) -> None
|
# type: (Sphinx, nodes.document, str) -> None
|
||||||
node = None # type: nodes.Element
|
"""Replace all todolist nodes with a list of the collected todos.
|
||||||
if not app.config['todo_include_todos']:
|
Augment each todo with a backlink to the original location.
|
||||||
for node in doctree.traverse(todo_node):
|
"""
|
||||||
node.parent.remove(node)
|
|
||||||
|
|
||||||
# Replace all todolist nodes with a list of the collected todos.
|
|
||||||
# Augment each todo with a backlink to the original location.
|
|
||||||
env = app.builder.env
|
env = app.builder.env
|
||||||
|
|
||||||
if not hasattr(env, 'todo_all_todos'):
|
if not hasattr(env, 'todo_all_todos'):
|
||||||
@ -201,7 +197,10 @@ def merge_info(app, env, docnames, other):
|
|||||||
|
|
||||||
def visit_todo_node(self, node):
|
def visit_todo_node(self, node):
|
||||||
# type: (HTMLTranslator, todo_node) -> None
|
# type: (HTMLTranslator, todo_node) -> None
|
||||||
self.visit_admonition(node)
|
if self.config.todo_include_todos:
|
||||||
|
self.visit_admonition(node)
|
||||||
|
else:
|
||||||
|
raise nodes.SkipNode
|
||||||
|
|
||||||
|
|
||||||
def depart_todo_node(self, node):
|
def depart_todo_node(self, node):
|
||||||
@ -211,11 +210,14 @@ def depart_todo_node(self, node):
|
|||||||
|
|
||||||
def latex_visit_todo_node(self, node):
|
def latex_visit_todo_node(self, node):
|
||||||
# type: (LaTeXTranslator, todo_node) -> None
|
# type: (LaTeXTranslator, todo_node) -> None
|
||||||
self.body.append('\n\\begin{sphinxadmonition}{note}{')
|
if self.config.todo_include_todos:
|
||||||
self.body.append(self.hypertarget_to(node))
|
self.body.append('\n\\begin{sphinxadmonition}{note}{')
|
||||||
title_node = cast(nodes.title, node[0])
|
self.body.append(self.hypertarget_to(node))
|
||||||
self.body.append('%s:}' % title_node.astext().translate(tex_escape_map))
|
title_node = cast(nodes.title, node[0])
|
||||||
node.pop(0)
|
self.body.append('%s:}' % title_node.astext().translate(tex_escape_map))
|
||||||
|
node.pop(0)
|
||||||
|
else:
|
||||||
|
raise nodes.SkipNode
|
||||||
|
|
||||||
|
|
||||||
def latex_depart_todo_node(self, node):
|
def latex_depart_todo_node(self, node):
|
||||||
|
Loading…
Reference in New Issue
Block a user