-
Notifications
You must be signed in to change notification settings - Fork 11
/
tasks.py
27 lines (22 loc) · 872 Bytes
/
tasks.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
import os
import shutil
from pathlib import Path
from invoke import run, task
from blueprint.tasks import web, bp, print, serve
ROOT = Path(__file__).parent
@task
def doc(ctx):
cwd = os.getcwd()
os.chdir(ROOT/'docs_src')
for path in (ROOT/'docs_src').glob('*.md'):
run(f'pandoc -t html --mathjax -f markdown+tex_math_dollars+raw_tex {path.name} --template template.html -o ../docs/{path.with_suffix(".html").name}')
os.chdir(cwd)
@task(doc, bp, web)
def all(ctx):
shutil.rmtree(ROOT/'docs'/'blueprint', ignore_errors=True)
shutil.copytree(ROOT/'blueprint'/'web', ROOT/'docs'/'blueprint')
shutil.copy2(ROOT/'blueprint'/'print'/'print.pdf', ROOT/'docs'/'blueprint.pdf')
@task(doc, web)
def html(ctx):
shutil.rmtree(ROOT/'docs'/'blueprint', ignore_errors=True)
shutil.copytree(ROOT/'blueprint'/'web', ROOT/'docs'/'blueprint')