summaryrefslogtreecommitdiff
path: root/sandbox/presentations/pycon2006/architecture-extending-and-embedding/demo/endnotes.py
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/presentations/pycon2006/architecture-extending-and-embedding/demo/endnotes.py')
-rw-r--r--sandbox/presentations/pycon2006/architecture-extending-and-embedding/demo/endnotes.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/sandbox/presentations/pycon2006/architecture-extending-and-embedding/demo/endnotes.py b/sandbox/presentations/pycon2006/architecture-extending-and-embedding/demo/endnotes.py
new file mode 100644
index 000000000..de9d2a49f
--- /dev/null
+++ b/sandbox/presentations/pycon2006/architecture-extending-and-embedding/demo/endnotes.py
@@ -0,0 +1,18 @@
+"""
+Move footnotes to the end of the document.
+"""
+
+from docutils import transforms
+from docutils import nodes
+
+class EndNotes(transforms.Transform):
+
+ default_priority = 950
+
+ def apply(self):
+ all_footnotes = []
+ assert isinstance(self.document, nodes.document)
+ for footnote in self.document.traverse(nodes.footnote):
+ all_footnotes.append(footnote)
+ footnote.parent.remove(footnote)
+ self.document += all_footnotes