mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
merge with 0.6
This commit is contained in:
commit
268911eb47
6
CHANGES
6
CHANGES
@ -54,6 +54,12 @@ Release 1.0 (in development)
|
|||||||
Release 0.6.4 (in development)
|
Release 0.6.4 (in development)
|
||||||
==============================
|
==============================
|
||||||
|
|
||||||
|
* #286: collect todo nodes after the whole document has been read;
|
||||||
|
this allows placing substitution references in todo items.
|
||||||
|
|
||||||
|
* #294: do not ignore an explicit ``today`` config value in a
|
||||||
|
LaTeX build.
|
||||||
|
|
||||||
* The ``alt`` text of inheritance diagrams is now much cleaner.
|
* The ``alt`` text of inheritance diagrams is now much cleaner.
|
||||||
|
|
||||||
* Ignore images in section titles when generating link captions.
|
* Ignore images in section titles when generating link captions.
|
||||||
|
@ -42,20 +42,31 @@ class Todo(Directive):
|
|||||||
ad = make_admonition(todo_node, self.name, [_('Todo')], self.options,
|
ad = make_admonition(todo_node, self.name, [_('Todo')], self.options,
|
||||||
self.content, self.lineno, self.content_offset,
|
self.content, self.lineno, self.content_offset,
|
||||||
self.block_text, self.state, self.state_machine)
|
self.block_text, self.state, self.state_machine)
|
||||||
|
ad[0].line = self.lineno
|
||||||
|
return [targetnode] + ad
|
||||||
|
|
||||||
# Attach a list of all todos to the environment,
|
|
||||||
# the todolist works with the collected todo nodes
|
def process_todos(app, doctree):
|
||||||
if not hasattr(env, 'todo_all_todos'):
|
# collect all todos in the environment
|
||||||
env.todo_all_todos = []
|
# this is not done in the directive itself because it some transformations
|
||||||
|
# must have already been run, e.g. substitutions
|
||||||
|
env = app.builder.env
|
||||||
|
if not hasattr(env, 'todo_all_todos'):
|
||||||
|
env.todo_all_todos = []
|
||||||
|
for node in doctree.traverse(todo_node):
|
||||||
|
try:
|
||||||
|
targetnode = node.parent[node.parent.index(node) - 1]
|
||||||
|
if not isinstance(targetnode, nodes.target):
|
||||||
|
raise IndexError
|
||||||
|
except IndexError:
|
||||||
|
targetnode = None
|
||||||
env.todo_all_todos.append({
|
env.todo_all_todos.append({
|
||||||
'docname': env.docname,
|
'docname': env.docname,
|
||||||
'lineno': self.lineno,
|
'lineno': node.line,
|
||||||
'todo': ad[0].deepcopy(),
|
'todo': node.deepcopy(),
|
||||||
'target': targetnode,
|
'target': targetnode,
|
||||||
})
|
})
|
||||||
|
|
||||||
return [targetnode] + ad
|
|
||||||
|
|
||||||
|
|
||||||
class TodoList(Directive):
|
class TodoList(Directive):
|
||||||
"""
|
"""
|
||||||
@ -152,6 +163,7 @@ def setup(app):
|
|||||||
|
|
||||||
app.add_directive('todo', Todo)
|
app.add_directive('todo', Todo)
|
||||||
app.add_directive('todolist', TodoList)
|
app.add_directive('todolist', TodoList)
|
||||||
|
app.connect('doctree-read', process_todos)
|
||||||
app.connect('doctree-resolved', process_todo_nodes)
|
app.connect('doctree-resolved', process_todo_nodes)
|
||||||
app.connect('env-purge-doc', purge_todos)
|
app.connect('env-purge-doc', purge_todos)
|
||||||
|
|
||||||
|
@ -180,8 +180,6 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
'pointsize': builder.config.latex_font_size,
|
'pointsize': builder.config.latex_font_size,
|
||||||
# if empty, the title is set to the first section title
|
# if empty, the title is set to the first section title
|
||||||
'title': document.settings.title,
|
'title': document.settings.title,
|
||||||
'date': ustrftime(builder.config.today_fmt
|
|
||||||
or _('%B %d, %Y')),
|
|
||||||
'release': builder.config.release,
|
'release': builder.config.release,
|
||||||
'author': document.settings.author,
|
'author': document.settings.author,
|
||||||
'releasename': _('Release'),
|
'releasename': _('Release'),
|
||||||
@ -194,6 +192,11 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
else:
|
else:
|
||||||
docclass = builder.config.latex_docclass.get('manual', 'report')
|
docclass = builder.config.latex_docclass.get('manual', 'report')
|
||||||
self.elements['docclass'] = docclass
|
self.elements['docclass'] = docclass
|
||||||
|
if builder.config.today:
|
||||||
|
self.elements['date'] = builder.config.today
|
||||||
|
else:
|
||||||
|
self.elements['date'] = ustrftime(builder.config.today_fmt
|
||||||
|
or _('%B %d, %Y'))
|
||||||
if builder.config.latex_logo:
|
if builder.config.latex_logo:
|
||||||
self.elements['logo'] = '\\includegraphics{%s}\\par' % \
|
self.elements['logo'] = '\\includegraphics{%s}\\par' % \
|
||||||
path.basename(builder.config.latex_logo)
|
path.basename(builder.config.latex_logo)
|
||||||
|
@ -24,6 +24,7 @@ Contents:
|
|||||||
metadata
|
metadata
|
||||||
extensions
|
extensions
|
||||||
doctest
|
doctest
|
||||||
|
extensions
|
||||||
|
|
||||||
Python <http://python.org/>
|
Python <http://python.org/>
|
||||||
|
|
||||||
|
@ -6,3 +6,23 @@ extlinks
|
|||||||
|
|
||||||
Test diverse links: :issue:`1000` and :pyurl:`dev/`, also with
|
Test diverse links: :issue:`1000` and :pyurl:`dev/`, also with
|
||||||
:issue:`explicit caption <1042>`.
|
:issue:`explicit caption <1042>`.
|
||||||
|
|
||||||
|
|
||||||
|
todo
|
||||||
|
----
|
||||||
|
|
||||||
|
.. todo::
|
||||||
|
|
||||||
|
Test the todo extension.
|
||||||
|
|
||||||
|
.. todo::
|
||||||
|
|
||||||
|
Test with |sub| (see #286).
|
||||||
|
|
||||||
|
.. |sub| replace:: substitution references
|
||||||
|
|
||||||
|
|
||||||
|
list of all todos
|
||||||
|
^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
.. todolist::
|
||||||
|
Loading…
Reference in New Issue
Block a user