-
Notifications
You must be signed in to change notification settings - Fork 21
/
contexts.py
79 lines (75 loc) · 2.69 KB
/
contexts.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
CONTEXTS = {
"html": dict(
context_name="html",
filetype=".html",
jinja_options=dict(
trim_blocks=True,
lstrip_blocks=True,
),
replacements={
r"\\ ": " ", # spaces
r"\\textbf{([^}]*)}": r"<strong>\1</strong>", # bold
r"\\textit{([^}]*)}": r"<em>\1</em>", # italic
r"\\LaTeX": "LaTeX", # \LaTeX
r"\\TeX": "TeX", # \TeX
"---": "—", # em dash
"--": "–", # en dash
r'``([^\']*)\'\'': r'"\1"', # quotes
r"\\%": "%", # percent
}
),
"latex": dict(
context_name="latex",
filetype=".tex",
output_filetype=".pdf",
jinja_options=dict(
block_start_string="~<",
block_end_string=">~",
variable_start_string="<<",
variable_end_string=">>",
comment_start_string="<#",
comment_end_string="#>",
trim_blocks=True,
lstrip_blocks=True,
),
replacements={}
),
"markdown": dict(
context_name="markdown",
filetype=".md",
jinja_options=dict(
trim_blocks=True,
lstrip_blocks=True,
),
replacements={
r"\\ ": " ", # spaces
r"\\textbf{([^}]*)}": r"**\1**", # bold text
r"\\textit{([^}]*)}": r"*\1*", # italic text
r"\\LaTeX": "LaTeX", # \LaTeX
r"\\TeX": "TeX", # \TeX
"---": "-", # em dash
"--": "-", # en dash
r'``([^\']*)\'\'': r'"\1"', # quotes
r"\\%": "%" , # percent
}
),
"plaintext": dict(
context_name="plaintext",
filetype=".txt",
jinja_options=dict(
trim_blocks=True,
lstrip_blocks=True,
),
replacements={
r"\\ ": " ", # spaces
r"\\textbf{([^}]*)}": r"**\1**", # bold text
r"\\textit{([^}]*)}": r"*\1*", # italic text
r"\\LaTeX": "LaTeX", # \LaTeX
r"\\TeX": "TeX", # \TeX
"---": "-", # em dash
"--": "-", # en dash
r'``([^\']*)\'\'': r'"\1"', # quotes
r"\\%": "%" , # percent
}
),
}