-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
54 lines (46 loc) · 1.31 KB
/
config.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
from pathlib import Path
import pypandoc
ROOT = Path(__file__).parent
TMP = ROOT.joinpath("_tmp")
def plain_pandoc(depends_on, produces):
if produces.suffix == ".html":
pypandoc.convert(
str(depends_on),
"html",
outputfile=str(produces),
extra_args=[
"--standalone",
"--self-contained",
"--mathjax",
f"--resource-path={depends_on.parent}",
],
)
elif produces.suffix == ".pdf":
pypandoc.convert(
str(depends_on),
"pdf",
outputfile=str(produces),
extra_args=["--pdf-engine=xelatex"],
)
else:
raise NotImplementedError(produces.suffix)
def revealjs_pandoc(depends_on, produces):
pypandoc.convert(
str(depends_on[0]),
"revealjs",
outputfile=str(produces),
extra_args=[
"--template=" + str(depends_on[1]),
"--section-divs",
"-t",
"html5",
"-V",
"theme:night",
"-V",
f"revealjs-url=file://{str(ROOT.absolute())}/revealjs",
"--no-highlight",
"--standalone",
"--self-contained",
f"--resource-path={depends_on[0].parent}",
],
)