summaryrefslogtreecommitdiffstats
path: root/Doc/tools
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2004-07-08 03:56:12 (GMT)
committerFred Drake <fdrake@acm.org>2004-07-08 03:56:12 (GMT)
commit63a0191c8af880be4bc45ec4147de74b74df10cc (patch)
treea9d0979f8b312f7e02e96c5cd4effd6ca899f8ef /Doc/tools
parent1c0423a2da8c98fad1e82b849fada06426db62f1 (diff)
downloadcpython-63a0191c8af880be4bc45ec4147de74b74df10cc.zip
cpython-63a0191c8af880be4bc45ec4147de74b74df10cc.tar.gz
cpython-63a0191c8af880be4bc45ec4147de74b74df10cc.tar.bz2
Deal with macros that have to be replaced with simple text; only a
couple of these are currently found in index data, but these should all be handled in the same way. Closes SF bug #952737.
Diffstat (limited to 'Doc/tools')
-rwxr-xr-xDoc/tools/buildindex.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/Doc/tools/buildindex.py b/Doc/tools/buildindex.py
index a07ed2f..5870462 100755
--- a/Doc/tools/buildindex.py
+++ b/Doc/tools/buildindex.py
@@ -13,17 +13,27 @@ from xml.sax.saxutils import quoteattr
bang_join = "!".join
null_join = "".join
+REPLACEMENTS = [
+ # Hackish way to deal with macros replaced with simple text
+ (re.compile(r"\\ABC\b"), "ABC"),
+ (re.compile(r"\\ASCII\b"), "ASCII"),
+ (re.compile(r"\\Cpp\b"), "C++"),
+ (re.compile(r"\\EOF\b"), "EOF"),
+ (re.compile(r"\\NULL\b"), "NULL"),
+ (re.compile(r"\\POSIX\b"), "POSIX"),
+ (re.compile(r"\\UNIX\b"), "Unix"),
+ # deal with turds left over from LaTeX2HTML
+ (re.compile(r"<#\d+#>"), ""),
+ ]
class Node:
- __rmjunk = re.compile("<#\d+#>")
-
continuation = 0
def __init__(self, link, str, seqno):
self.links = [link]
self.seqno = seqno
- # remove <#\d+#> left in by moving the data out of LaTeX2HTML
- str = self.__rmjunk.sub('', str)
+ for pattern, replacement in REPLACEMENTS:
+ str = pattern.sub(replacement, str)
# build up the text
self.text = split_entry_text(str)
self.key = split_entry_key(str)