mirror of https://github.com/eyhc1/rendercv.git
trim blocks in templates
This commit is contained in:
parent
4f1a9b8808
commit
1070259e5b
|
@ -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)
|
||||
|
||||
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ def render(latexFilePath):
|
|||
[
|
||||
f"{tinytexPath}\\latexmk.exe",
|
||||
"-lualatex",
|
||||
"-c",
|
||||
# "-c",
|
||||
"test.tex",
|
||||
"-synctex=1",
|
||||
"-interaction=nonstopmode",
|
||||
|
|
Loading…
Reference in New Issue