Organize classes
This commit is contained in:
parent
a016599abc
commit
22765e7601
16
generate.py
16
generate.py
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/env python3.9
|
#!/bin/env python3.9
|
||||||
from subprocess import run
|
from subprocess import run
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from os import makedirs
|
from os import makedirs, environ
|
||||||
from os.path import relpath
|
from os.path import relpath
|
||||||
from re import findall
|
from re import findall
|
||||||
from glob import glob
|
from glob import glob
|
||||||
|
@ -153,7 +153,7 @@ class HtmlFile(FromTeX):
|
||||||
def write_output(self):
|
def write_output(self):
|
||||||
args = [
|
args = [
|
||||||
'pandoc',
|
'pandoc',
|
||||||
'--mathjax=templates/mathjax/es5/tex-mml-chtml.js',
|
'--mathjax=static/mathjax/es5/tex-mml-chtml.js',
|
||||||
'-f', 'latex',
|
'-f', 'latex',
|
||||||
'-t', 'html',
|
'-t', 'html',
|
||||||
'-'
|
'-'
|
||||||
|
@ -214,19 +214,27 @@ class PdfFile(FromTeX):
|
||||||
def write_output(self):
|
def write_output(self):
|
||||||
parent_dir = self.output_file.parent
|
parent_dir = self.output_file.parent
|
||||||
makedirs(parent_dir, exist_ok=True)
|
makedirs(parent_dir, exist_ok=True)
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
'pdflatex',
|
'pdflatex',
|
||||||
'-jobname', self.output_file.stem,
|
'-jobname', self.output_file.stem,
|
||||||
'-output-directory', parent_dir,
|
'-output-directory', parent_dir,
|
||||||
'-shell-escape',
|
'-shell-escape'
|
||||||
'-8bit'
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
env = {
|
||||||
|
**environ,
|
||||||
|
'TEXINPUTS': './include:'
|
||||||
|
}
|
||||||
|
|
||||||
proc = run(args,
|
proc = run(args,
|
||||||
|
env=env,
|
||||||
input=bytes(self.tex_file.content, 'utf-8'),
|
input=bytes(self.tex_file.content, 'utf-8'),
|
||||||
capture_output=True)
|
capture_output=True)
|
||||||
|
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
print(proc.stdout, file=stderr)
|
print(proc.stdout, file=stderr)
|
||||||
|
print(proc.stderr, file=stderr)
|
||||||
exit(proc.returncode)
|
exit(proc.returncode)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue