-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconf.py
57 lines (51 loc) · 1.35 KB
/
conf.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from string import whitespace, ascii_letters, digits
from regl.aux import dict_invert
punctuation = "@!,.'\"\\/()-:;*?<>"
tokTok = "^"
indentTok = tokTok + "INDENT"
dedentTok = tokTok + "DEDENT"
vspaceTok = tokTok + "VSPACE"
hspaceTok = "[HSPACE]"
lineEndTok = "$"
itemTok = tokTok + "ITEM"
sectionSignTok = "[section-sign]"
superTok = "~"
parTok = "]"
commentTok = "#"
nilItemToken = '0'
articlePrefixToken = 'Artikel'
NBPrefixToken = 'NB'
specialChars = commentTok + superTok + parTok
wordChars = ascii_letters + digits + punctuation
allowedChars = wordChars + specialChars + whitespace
charNames = (
("<", "<chevron-open>"),
(">", "<chevron-close>"),
("\xe9", "<e-acute>"),
("\xeb", "<e-umlaut>"),
("\xf3", "<o-acute>"),
("\xf6", "<o-umlaut>"),
("\x81", "<u-umlaut>"),
("\xa7", sectionSignTok),
("\u20ac", "<euro-sign>"))
LaTeXCharNames = (
("<", r"["),
(">", r"]"),
("\xe9", r"\'e"),
("\xeb", r"\"e"),
("\xf3", r"\'o"),
("\xf6", r"\"o"),
("\x81", r"\"u"),
("\xa7", sectionSignTok),
("\u20ac", r"\euro"))
def createCharMap(n):
charMap = {}
for c in allowedChars:
charMap[c]=c
for c,n in n:
charMap[c]=n
return charMap
charMap = createCharMap(charNames) # can decorators do this?
charMapI = dict_invert(charMap)
LaTeXCharMap = createCharMap(LaTeXCharNames) # can decorators do this?
LaTeXCharMapI = dict_invert(LaTeXCharMap)