notes, and add code to enable sorted "..todo:: P[1-5] xyz" syntax

This commit is contained in:
root 2010-11-12 09:25:01 -08:00
parent dc154f98bd
commit 1a020c2713
2 changed files with 28 additions and 12 deletions

View File

@ -3,10 +3,12 @@
from sphinx.ext.todo import *
from docutils.parsers.rst import directives
import re
def _(s):
return s
def process_todo_nodes(app, doctree, fromdocname):
if not app.config['todo_include_todos']:
for node in doctree.traverse(todo_node):
@ -19,20 +21,20 @@ def process_todo_nodes(app, doctree, fromdocname):
if not hasattr(env, 'todo_all_todos'):
env.todo_all_todos = []
my_todo_list = nodes.bullet_list("", nodes.Text('',''));
# remove the item that was added in the constructor, since I'm tired of
# reading through docutils for the proper way to construct an empty list
my_todo_list.remove(my_todo_list[0])
lists = []
for i in xrange(5):
lists.append(nodes.bullet_list("", nodes.Text('','')));
lists[i].remove(lists[i][0])
lists[i].set_class('todo_list')
my_todo_list.set_class('todo_list')
for node in doctree.traverse(todolist):
if not app.config['todo_include_todos']:
node.replace_self([])
continue
content = []
for todo_info in env.todo_all_todos:
para = nodes.paragraph()
filename = env.doc2path(todo_info['docname'], base=None)
@ -54,20 +56,33 @@ def process_todo_nodes(app, doctree, fromdocname):
newnode.append(innernode)
para += newnode
para.set_class("link")
para.set_class('todo_link')
todo_entry = todo_info['todo']
env.resolve_references(todo_entry, todo_info['docname'], app.builder)
item = nodes.list_item("", para)
todo_entry[1].set_class("details")
item.append(todo_entry[1])
item = nodes.list_item('', para)
todo_entry[1].set_class('details')
my_todo_list.insert(0, item)
comment = todo_entry[1]
m = re.match(r"^P(\d)", comment.astext())
priority = 5
if m:
priority = int(m.group(1))
if (priority < 0): priority = 1
if (priority > 5): priority = 5
item.set_class('todo_p' + str(priority))
todo_entry.set_class('todo_p' + str(priority))
item.append(comment)
lists[priority-1].insert(0, item)
node.replace_self(my_todo_list)
node.replace_self(lists)
def setup(app):
app.add_config_value('todo_include_todos', False, False)

View File

@ -21,6 +21,7 @@ Networking Overview
In Nova, users organize their cloud resources in projects. A Nova project consists of a number of VM instances created by a user. For each VM instance, Nova assigns to it a private IP address. (Currently, Nova only supports Linux bridge networking that allows the virtual interfaces to connect to the outside network through the physical interface. Other virtual network technologies, such as Open vSwitch, could be supported in the future.) The Network Controller provides virtual networks to enable compute servers to interact with each other and with the public network.
..
(perhaps some of this should be moved elsewhere)
Introduction
------------
@ -51,7 +52,7 @@ Read more about Nova network strategies here:
Network Management Commands
---------------------------
Admins and Network Administrators can use the 'nova-manage' command to manage project resources:
Admins and Network Administrators can use the 'nova-manage' command to manage network resources:
VPN Management
~~~~~~~~~~~~~~