summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-05-28 21:02:22 -0400
committerNed Batchelder <ned@nedbatchelder.com>2009-05-28 21:02:22 -0400
commitb42985e17c3ae2071939c451d9a82865ca53608d (patch)
treec282fc2463b2fdf3a76ae9a2b8119258a4d13f27
parentdaad5a9fbd34cc7e07be511654085e57b03de9b4 (diff)
downloadpython-coveragepy-git-b42985e17c3ae2071939c451d9a82865ca53608d.tar.gz
Parse document fields to create revision history metadata.
-rw-r--r--doc/_ext/px_xlator.py27
1 files changed, 17 insertions, 10 deletions
diff --git a/doc/_ext/px_xlator.py b/doc/_ext/px_xlator.py
index 7bc3d69a..439926c0 100644
--- a/doc/_ext/px_xlator.py
+++ b/doc/_ext/px_xlator.py
@@ -30,17 +30,24 @@ class PxTranslator(BaseHtmlXlator):
else:
BaseHtmlXlator.visit_title(self, node)
- # TODO: get history from here?
def visit_field_list(self, node):
- raise nodes.SkipNode
-
- def depart_field_list(self, node): pass
- def visit_field(self, node): pass
- def depart_field(self, node): pass
- def visit_field_name(self, node): pass
- def depart_field_name(self, node): pass
- def visit_field_body(self, node): pass
- def depart_field_body(self, node): pass
+ self.history = []
+
+ def depart_field_list(self, node):
+ if self.history:
+ self.body.append("<history>\n")
+ for hist in self.history:
+ when, what = hist.split(',')
+ self.body.append("<what when='%s'>%s</what>\n" % (when, self.encode(what.strip())))
+ self.body.append("</history>\n")
+
+ def visit_field(self, node):
+ if node.children[0].astext() == 'history':
+ self.history.append(node.children[1].astext())
+ raise nodes.SkipChildren
+
+ def depart_field(self, node):
+ pass
def visit_literal_block(self, node):
if node.rawsource != node.astext():