summaryrefslogtreecommitdiffstats
path: root/Doc/tools
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1999-02-18 16:32:21 (GMT)
committerFred Drake <fdrake@acm.org>1999-02-18 16:32:21 (GMT)
commit93d762fc7af7080cdd2ccaa336178b09aa822efa (patch)
treea37345c53fac6eb516f4158e8a953913144b1b17 /Doc/tools
parent997eec7cca2bbe1e1e6b1568126b849ce3c49e63 (diff)
downloadcpython-93d762fc7af7080cdd2ccaa336178b09aa822efa.zip
cpython-93d762fc7af7080cdd2ccaa336178b09aa822efa.tar.gz
cpython-93d762fc7af7080cdd2ccaa336178b09aa822efa.tar.bz2
Mark <verbatim> elements that represent interactive sessions; these
become <interpreter-session> elements.
Diffstat (limited to 'Doc/tools')
-rwxr-xr-xDoc/tools/sgmlconv/docfixer.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Doc/tools/sgmlconv/docfixer.py b/Doc/tools/sgmlconv/docfixer.py
index 589ecea..bee99fa 100755
--- a/Doc/tools/sgmlconv/docfixer.py
+++ b/Doc/tools/sgmlconv/docfixer.py
@@ -570,6 +570,7 @@ RECURSE_INTO_PARA_CONTAINERS = (
PARA_LEVEL_ELEMENTS = (
"moduleinfo", "title", "verbatim", "enumerate", "item",
+ "interpreter-session",
"opcodedesc", "classdesc", "datadesc",
"funcdesc", "methoddesc", "excdesc",
"funcdescni", "methoddescni", "excdescni",
@@ -757,6 +758,15 @@ def fixup_sectionauthors(doc):
section.insertBefore(sectauth, after)
+def fixup_verbatims(doc):
+ for verbatim in find_all_elements(doc, "verbatim"):
+ child = verbatim.childNodes[0]
+ if child.nodeType == xml.dom.core.TEXT \
+ and string.lstrip(child.data)[:3] == ">>>":
+ verbatim._node.name = "interpreter-session"
+ #verbatim.setAttribute("interactive", "interactive")
+
+
_token_rx = re.compile(r"[a-zA-Z][a-zA-Z0-9.-]*$")
def write_esis(doc, ofp, knownempty):
@@ -806,6 +816,7 @@ def convert(ifp, ofp):
cleanup_trailing_parens(doc, ["function", "method", "cfunction"])
cleanup_synopses(doc)
fixup_descriptors(doc)
+ fixup_verbatims(doc)
normalize(doc)
fixup_paras(doc)
fixup_sectionauthors(doc)