summaryrefslogtreecommitdiff
path: root/docutils/transforms/peps.py
diff options
context:
space:
mode:
authorgoodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2004-04-23 13:48:24 +0000
committergoodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2004-04-23 13:48:24 +0000
commit31469d79ad65bada6af245fcb0ded1d0bff1ae6c (patch)
tree3ecf00d0130cbc5078798a34ed830f2072a19992 /docutils/transforms/peps.py
parent9329bd71c86d27e21d2fba2017c9f71cb78ef6cb (diff)
downloaddocutils-31469d79ad65bada6af245fcb0ded1d0bff1ae6c.tar.gz
Updated for ToC changes (topic now inserted by directive, so follow suit here). Fixes SF bug 928482.
git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@1986 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/transforms/peps.py')
-rw-r--r--docutils/transforms/peps.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/docutils/transforms/peps.py b/docutils/transforms/peps.py
index 9ae7fa80b..fdd750d0c 100644
--- a/docutils/transforms/peps.py
+++ b/docutils/transforms/peps.py
@@ -19,7 +19,7 @@ import sys
import os
import re
import time
-from docutils import nodes, utils
+from docutils import nodes, utils, languages
from docutils import ApplicationError, DataError
from docutils.transforms import Transform, TransformError
from docutils.transforms import parts, references, misc
@@ -137,15 +137,24 @@ class Headers(Transform):
class Contents(Transform):
"""
- Insert a table of contents transform placeholder into the document after
- the RFC 2822 header.
+ Insert an empty table of contents topic and a transform placeholder into
+ the document after the RFC 2822 header.
"""
default_priority = 380
def apply(self):
- pending = nodes.pending(parts.Contents, {'title': None})
- self.document.insert(1, pending)
+ language = languages.get_language(self.document.settings.language_code)
+ name = language.labels['contents']
+ title = nodes.title('', name)
+ topic = nodes.topic('', title, CLASS='contents')
+ name = nodes.fully_normalize_name(name)
+ if not self.document.has_name(name):
+ topic['name'] = name
+ self.document.note_implicit_target(topic)
+ pending = nodes.pending(parts.Contents)
+ topic += pending
+ self.document.insert(1, topic)
self.document.note_pending(pending)