Browse Source

UCWTeX: Na výrobu pdf si pustíme luatex a naučíme ho hledat soubory

Jiří Kalvoda 8 months ago
parent
commit
c883cefdde
  1. 9
      src/formatitko/formatitko.py

9
src/formatitko/formatitko.py

@ -2,9 +2,11 @@
import argparse
import sys
import os
import tempfile
import subprocess
import shutil
from pathlib import Path
# Import local files
from .util import import_md
@ -112,7 +114,12 @@ def main():
else:
filename = args.output_tex
outdir = tempfile.TemporaryDirectory(prefix="formatitko")
subprocess.run(["pdfcsplain", "-halt-on-error", "-output-directory="+outdir.name, "-jobname=formatitko", filename], check=True)
env = os.environ.copy()
d = Path("/".join(__file__.split("/")[:-1]))
env["TEXINPUTS"]=".:"+str(d/"tex")+":"+env.get("TEXINPUTS", "")
subprocess.run(["luatex", "-halt-on-error", "-output-directory="+outdir.name, "-jobname=formatitko", filename], check=True, env=env)
shutil.move(outdir.name+"/formatitko.pdf", args.output_pdf)
if args.deps is not None:

Loading…
Cancel
Save