From: David G. <go...@us...> - 2002-07-14 02:47:44
|
Update of /cvsroot/docutils/docutils/docutils/transforms In directory usw-pr-cvs1:/tmp/cvs-serv28705/docutils/docutils/transforms Modified Files: peps.py Log Message: Added a transform to insert a table of contents. Index: peps.py =================================================================== RCS file: /cvsroot/docutils/docutils/docutils/transforms/peps.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** peps.py 13 Jul 2002 02:59:13 -0000 1.4 --- peps.py 14 Jul 2002 02:47:41 -0000 1.5 *************** *** 22,25 **** --- 22,26 ---- from docutils import ApplicationError, DataError from docutils.transforms import Transform, TransformError + from docutils.transforms import parts *************** *** 99,100 **** --- 100,115 ---- elif name == 'version' and len(body): utils.clean_rcs_keywords(para, self.rcs_keyword_substitutions) + + + class Contents(Transform): + + """ + Insert a table of contents into the document after the RFC 2822 header. + """ + + + def transform(self): + pending = nodes.pending(parts.Contents, 'last reader', + {'title': None}) + self.document.insert(1, pending) + self.document.note_pending(pending) |