From 1070259e5bfd4f99f88a48961a5b00d2003c01a6 Mon Sep 17 00:00:00 2001 From: Sina Atalay Date: Sun, 3 Sep 2023 19:40:02 +0200 Subject: [PATCH] trim blocks in templates --- rendercv/rendercv.py | 19 +++++++++---------- rendercv/tinytex/render.py | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/rendercv/rendercv.py b/rendercv/rendercv.py index 64931cd..d737ae1 100644 --- a/rendercv/rendercv.py +++ b/rendercv/rendercv.py @@ -1,6 +1,7 @@ from jinja2 import Environment, FileSystemLoader from data.content import CurriculumVitae + # from . import tinytex # https://github.com/praw-dev/praw/blob/master/praw/reddit.py # from . import templates, sonra mesela: classic.render() tarzi seyler olabilir from tinytex.render import render @@ -9,18 +10,19 @@ import os import json - if __name__ == "__main__": workspace = os.path.dirname(os.path.dirname(__file__)) templateName = "classic" templatePath = os.path.join(workspace, "rendercv", "templates", templateName) - environment = Environment(loader=FileSystemLoader(templatePath)) + environment = Environment( + loader=FileSystemLoader(templatePath), trim_blocks=True, lstrip_blocks=True + ) environment.block_start_string = "((*" environment.block_end_string = "*))" - environment.variable_start_string = "(((" - environment.variable_end_string = ")))" - environment.comment_start_string = "((=" - environment.comment_end_string = "=))" + environment.variable_start_string = "<<" + environment.variable_end_string = ">>" + environment.comment_start_string = "((#" + environment.comment_end_string = "#))" template = environment.get_template(f"{templateName}.tex.j2") @@ -34,11 +36,8 @@ if __name__ == "__main__": # Create an output file and write the rendered LaTeX code to it: output_file_path = os.path.join(workspace, "tests", "outputs", "test.tex") + os.makedirs(os.path.dirname(output_file_path), exist_ok=True) with open(output_file_path, "w") as file: file.write(output_latex_file) render(output_file_path) - - - - \ No newline at end of file diff --git a/rendercv/tinytex/render.py b/rendercv/tinytex/render.py index 7f47808..ac93e41 100644 --- a/rendercv/tinytex/render.py +++ b/rendercv/tinytex/render.py @@ -16,7 +16,7 @@ def render(latexFilePath): [ f"{tinytexPath}\\latexmk.exe", "-lualatex", - "-c", + # "-c", "test.tex", "-synctex=1", "-interaction=nonstopmode",