From 22765e7601a266a1fe3e15be27793c8cdd33244b Mon Sep 17 00:00:00 2001 From: Augusto Gunsch Date: Mon, 14 Feb 2022 15:33:39 -0300 Subject: [PATCH] Organize classes --- generate.py | 16 ++++++++++++---- bookreport.cls => include/bookreport.cls | 0 note.cls => include/note.cls | 0 3 files changed, 12 insertions(+), 4 deletions(-) rename bookreport.cls => include/bookreport.cls (100%) rename note.cls => include/note.cls (100%) diff --git a/generate.py b/generate.py index 42de50b..17758ac 100755 --- a/generate.py +++ b/generate.py @@ -1,7 +1,7 @@ #!/bin/env python3.9 from subprocess import run from datetime import date -from os import makedirs +from os import makedirs, environ from os.path import relpath from re import findall from glob import glob @@ -153,7 +153,7 @@ class HtmlFile(FromTeX): def write_output(self): args = [ 'pandoc', - '--mathjax=templates/mathjax/es5/tex-mml-chtml.js', + '--mathjax=static/mathjax/es5/tex-mml-chtml.js', '-f', 'latex', '-t', 'html', '-' @@ -214,19 +214,27 @@ class PdfFile(FromTeX): def write_output(self): parent_dir = self.output_file.parent makedirs(parent_dir, exist_ok=True) + args = [ 'pdflatex', '-jobname', self.output_file.stem, '-output-directory', parent_dir, - '-shell-escape', - '-8bit' + '-shell-escape' ] + + env = { + **environ, + 'TEXINPUTS': './include:' + } + proc = run(args, + env=env, input=bytes(self.tex_file.content, 'utf-8'), capture_output=True) if proc.returncode != 0: print(proc.stdout, file=stderr) + print(proc.stderr, file=stderr) exit(proc.returncode) diff --git a/bookreport.cls b/include/bookreport.cls similarity index 100% rename from bookreport.cls rename to include/bookreport.cls diff --git a/note.cls b/include/note.cls similarity index 100% rename from note.cls rename to include/note.cls