Add error for drawings build failure
This commit is contained in:
@@ -21,7 +21,7 @@ def build_drawing(id, width=9.0):
|
|||||||
latex = file.read()
|
latex = file.read()
|
||||||
|
|
||||||
# Workaround, if the picture contains a document class it should be ignored:
|
# Workaround, if the picture contains a document class it should be ignored:
|
||||||
if ("\\begin{document}" in latex or "\\begin{table}" in latex):
|
if "\\begin{document}" in latex or "\\begin{table}" in latex:
|
||||||
print(f"Error: drawing file '{drawing}' contains a document environment.")
|
print(f"Error: drawing file '{drawing}' contains a document environment.")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ def build_drawing(id, width=9.0):
|
|||||||
with (img_path / f"{id}include.tex").open("w") as file:
|
with (img_path / f"{id}include.tex").open("w") as file:
|
||||||
file.write(latex)
|
file.write(latex)
|
||||||
|
|
||||||
# Write the auxilary LaTeX file:
|
# Write the auxiliary LaTeX file:
|
||||||
aux_file = build_path / f"{id}.tex"
|
aux_file = build_path / f"{id}.tex"
|
||||||
|
|
||||||
with aux_file.open("w", encoding="utf-8") as file:
|
with aux_file.open("w", encoding="utf-8") as file:
|
||||||
@@ -72,5 +72,6 @@ if __name__ == "__main__":
|
|||||||
else:
|
else:
|
||||||
width = 9.0
|
width = 9.0
|
||||||
|
|
||||||
print(f"Building picture {id}. This might take a while ... ")
|
print(f"Building picture {id}. This might take a while ...")
|
||||||
build_drawing(id, width)
|
if not build_drawing(id, width):
|
||||||
|
print("Build failed.")
|
||||||
|
|||||||
Reference in New Issue
Block a user