added flake.nix to provide a build and dev environnement to bootstrap a venv with presenterm and weasyprint easily added a package output to flake.nix to build all the posts. the build process use a python script for easier extensibility
15 lines
503 B
Python
15 lines
503 B
Python
import os
|
|
from pathlib import Path
|
|
from subprocess import run
|
|
|
|
posts = [post for topic in Path("./posts").iterdir() for post in topic.iterdir()]
|
|
|
|
config = Path(os.environ.get("PRES_CONFIG", "./configs/presenterm.yaml"))
|
|
|
|
out_dir = Path('./output')
|
|
out_dir.exists() or out_dir.mkdir()
|
|
|
|
for post_dir in posts:
|
|
run_result = run([f"presenterm -e --config-file {config} {post_dir / f'{post_dir.name}.md'}"], shell = True)
|
|
(post_dir / f'{post_dir.name}.pdf').replace(out_dir / f'{post_dir.name}.pdf')
|