Skip to content
Snippets Groups Projects
Verified Commit 209237d4 authored by simeon's avatar simeon
Browse files

return LaTeX logs when pandoc fails

parent 89d3bbef
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@ import os
PORT = 8000
URL_FORMAT = re.compile(
r"^(?:(?:https://)?platform\.physik\.kit\.edu/codimd/)?(?P<id>[\w_-]+)([\?#].*)?$"
r"^(?:(?:https://)?platform\.physik\.kit\.edu/codimd/)?(?P<id>[\w_-]+)([\?#].*)?$",
)
TMP_MD = "tmp.md"
......@@ -78,7 +78,7 @@ class CodiToPdfHandler(http.server.SimpleHTTPRequestHandler):
return
try:
subprocess.check_call(
subprocess.check_output(
[
"pandoc",
# disable yaml in markdown
......@@ -89,13 +89,17 @@ class CodiToPdfHandler(http.server.SimpleHTTPRequestHandler):
"-s", "-V", "papersize:a4",
"-V", "geometry:margin=1in",
"-o", TMP_PDF,
TMP_MD
]
TMP_MD,
],
stderr=subprocess.STDOUT,
)
assert os.path.isfile(TMP_PDF)
except Exception as e:
if isinstance(e, subprocess.CalledProcessError):
self.errored("Error while converting markdown to pdf:\n" + str(e))
self.errored(
"Error occured while converting markdown to pdf:\n\n" +
e.output.decode("utf-8"),
)
else:
self.errored("Unknown error")
clean_up()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment