|
13 | 13 | bang_join = "!".join |
14 | 14 | null_join = "".join |
15 | 15 |
|
| 16 | +REPLACEMENTS = [ |
| 17 | + # Hackish way to deal with macros replaced with simple text |
| 18 | + (re.compile(r"\\ABC\b"), "ABC"), |
| 19 | + (re.compile(r"\\ASCII\b"), "ASCII"), |
| 20 | + (re.compile(r"\\Cpp\b"), "C++"), |
| 21 | + (re.compile(r"\\EOF\b"), "EOF"), |
| 22 | + (re.compile(r"\\NULL\b"), "NULL"), |
| 23 | + (re.compile(r"\\POSIX\b"), "POSIX"), |
| 24 | + (re.compile(r"\\UNIX\b"), "Unix"), |
| 25 | + # deal with turds left over from LaTeX2HTML |
| 26 | + (re.compile(r"<#\d+#>"), ""), |
| 27 | + ] |
16 | 28 |
|
17 | 29 | class Node: |
18 | | - __rmjunk = re.compile("<#\d+#>") |
19 | | - |
20 | 30 | continuation = 0 |
21 | 31 |
|
22 | 32 | def __init__(self, link, str, seqno): |
23 | 33 | self.links = [link] |
24 | 34 | self.seqno = seqno |
25 | | - # remove <#\d+#> left in by moving the data out of LaTeX2HTML |
26 | | - str = self.__rmjunk.sub('', str) |
| 35 | + for pattern, replacement in REPLACEMENTS: |
| 36 | + str = pattern.sub(replacement, str) |
27 | 37 | # build up the text |
28 | 38 | self.text = split_entry_text(str) |
29 | 39 | self.key = split_entry_key(str) |
|
0 commit comments