From 547cffefe61951315c2770e5c36deb46e303540f Mon Sep 17 00:00:00 2001 From: Sina Atalay Date: Sat, 9 Sep 2023 17:36:19 +0200 Subject: [PATCH] add new dependencies to requirements.txt --- rendercv/rendercv.py | 73 ------------------------------------------- requirements.txt | Bin 348 -> 488 bytes 2 files changed, 73 deletions(-) delete mode 100644 rendercv/rendercv.py diff --git a/rendercv/rendercv.py b/rendercv/rendercv.py deleted file mode 100644 index 3959444..0000000 --- a/rendercv/rendercv.py +++ /dev/null @@ -1,73 +0,0 @@ -import os -import json -import logging -import re - -from jinja2 import Environment, FileSystemLoader - -from data.data_model import RenderCVDataModel - -# 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 - - - - -if __name__ == "__main__": - # logging config: - logging.basicConfig( - level=logging.DEBUG, - format="%(name)s - %(levelname)s - %(message)s", - ) - - workspace = os.path.dirname(os.path.dirname(__file__)) - templateName = "classic" - templatePath = os.path.join(workspace, "rendercv", "templates", templateName) - environment = Environment( - loader=FileSystemLoader(templatePath), trim_blocks=True, lstrip_blocks=True - ) - - def markdown_to_latex(value: str) -> str: - """ - To be continued... - """ - # convert links - link = re.search("\[(.*)\]\((.*?)\)", value) - if link is not None: - link = link.groups() - oldLinkString = "[" + link[0] + "](" + link[1] + ")" - newLinkString = "\hrefExternal{" + link[1] + "}{" + link[0] + "}" - - value = value.replace(oldLinkString, newLinkString) - - return value - - environment.filters["markdown_to_latex"] = markdown_to_latex - - environment.block_start_string = "((*" - environment.block_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") - - inpur_name = "personal" - - input_file_path = os.path.join(workspace, "tests", "inputs", f"{inpur_name}.json") - with open(input_file_path) as file: - raw_json = json.load(file) - - data = RenderCVDataModel(**raw_json) - - output_latex_file = template.render(design=data.design.options, cv=data.cv) - - # Create an output file and write the rendered LaTeX code to it: - output_file_path = os.path.join(workspace, "tests", "outputs", f"{inpur_name}.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) diff --git a/requirements.txt b/requirements.txt index 0942fe0252edcb35c9f34a28cd88747e98e6780f..9367c38dceccace09f0775041b53d125dfc71dae 100644 GIT binary patch delta 149 zcmcb^^n!Uq3}Zbn0~bR9LnT8okW6LB0m5X43?M6+Asa{*G1vm30fQccIS?B$fK(ST qlrkhT