Skip to content
Snippets Groups Projects
Commit 476c952e authored by Jiří Kalvoda's avatar Jiří Kalvoda
Browse files

prace: Relativizace adresářů buildu a nerelinkování výstupu

parent aa3ab92f
No related branches found
No related tags found
No related merge requests found
......@@ -181,11 +181,11 @@ def main(build_dir=Path("build_pdf"), link_out=True):
## MAIN ###
doc = import_md(open("bakalarka/index.md", "r").read(), bibliography="bakalarka/sample.bib")
doc = import_md(open(d/"index.md", "r").read(), bibliography=d/"sample.bib")
OutputGenerator(sys.stdout).generate(doc)
tp = TransformProcessor("bakalarka/index.md")
tp = TransformProcessor(str(d/"index.md"))
tp.add_command_module(formatitko_commands)
try:
doc = tp.transform(doc)
......@@ -227,15 +227,14 @@ def main(build_dir=Path("build_pdf"), link_out=True):
f.write(source.read())
if link_out:
if os.path.exists("bakalarka.pdf"):
os.remove("bakalarka.pdf")
if not os.path.exists("bakalarka.pdf"):
os.link(build_dir/'bakalarka.pdf', 'bakalarka.pdf')
with open(build_dir/"bakalarka-vera.html", "w") as file:
vera_run = subprocess.run(["verapdf", "bakalarka.pdf", "-f", "2u", "--format", "html"], stdout=file, cwd=build_dir)
if vera_run.returncode:
print(f"VERA PDF-A VALIDATION FAILD (returncode {vera_run.returncode})")
print(f"Details: file://{build_dir}/bakalarka-vera.html")
print(f"Details: file://{os.path.abspath(build_dir)}/bakalarka-vera.html")
exit(vera_run.returncode)
def __main__():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment