diff --git a/docs/contact.md b/docs/contact.md index e69de29..a81e25d 100644 --- a/docs/contact.md +++ b/docs/contact.md @@ -0,0 +1,5 @@ +--- +hide: + - navigation +--- +test \ No newline at end of file diff --git a/docs/reference/__main__.md b/docs/documentation/__main__.md similarity index 100% rename from docs/reference/__main__.md rename to docs/documentation/__main__.md diff --git a/docs/reference/data_model.md b/docs/documentation/data_model.md similarity index 100% rename from docs/reference/data_model.md rename to docs/documentation/data_model.md diff --git a/docs/documentation/index.md b/docs/documentation/index.md new file mode 100644 index 0000000..daeafc6 --- /dev/null +++ b/docs/documentation/index.md @@ -0,0 +1,11 @@ +# RenderCV + +::: rendercv + +In this section, you can find how RenderCV works in detail. + +Modules: + +- [\_\_main\_\_](__main__.md) – This module is a script to run the RenderCV and generate a CV as a PDF. +- [data_model](data_model.md) – This module contains classes and functions to parse RenderCV's specifically structured YAML or JSON to generate meaningful data for Python. +- [rendering](rendering.md) – This module implements LaTeX file generation and LaTeX runner utilities for RenderCV. \ No newline at end of file diff --git a/docs/documentation/rendering.md b/docs/documentation/rendering.md new file mode 100644 index 0000000..a3e4769 --- /dev/null +++ b/docs/documentation/rendering.md @@ -0,0 +1,3 @@ +# Rendering + +::: rendercv.rendering \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index e224ad5..e05db71 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,5 +1,11 @@ -# Welcome to RenderCV +--- +hide: + - navigation + - toc +--- -It's a simple tool to render your CV from a YAML file. +# RenderCV: Overview + +A simple tool to render your $\LaTeX$ CV or resume from a YAML file. It's a work in progress, please come back later. \ No newline at end of file diff --git a/docs/reference/index.md b/docs/reference/index.md deleted file mode 100644 index 8318c86..0000000 --- a/docs/reference/index.md +++ /dev/null @@ -1 +0,0 @@ -Test \ No newline at end of file diff --git a/docs/reference/tinytex.md b/docs/reference/tinytex.md deleted file mode 100644 index 2b4420d..0000000 --- a/docs/reference/tinytex.md +++ /dev/null @@ -1,2 +0,0 @@ -# TinyTeX -::: rendercv.tinytex \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 219d92f..724e50c 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -43,11 +43,11 @@ theme: nav: - Quick Start: index.md - Contact: contact.md - - Code Reference: - - Code Reference: reference/index.md - - __main__.py: reference/__main__.md - - data_model.py: reference/data_model.md - - rendering.py: reference/rendering.md + - Code Documentation: + - Code Reference: documentation/index.md + - __main__.py: documentation/__main__.md + - data_model.py: documentation/data_model.md + - rendering.py: documentation/rendering.md plugins: - search diff --git a/rendercv/__init__.py b/rendercv/__init__.py index 545583e..480bd13 100644 --- a/rendercv/__init__.py +++ b/rendercv/__init__.py @@ -1,4 +1,4 @@ -"""RenderCV package +"""RenderCV package. -A Python application that creates a CV in PDF from a YAML/JSON input file. -""" \ No newline at end of file +It parses the user input YAML/JSON file and validates the data (checks spelling mistakes, checks if the dates are consistent, etc.). Then, with the data, it creates a $\LaTeX$ file and renders it with [TinyTeX](https://yihui.org/tinytex/). +""" diff --git a/rendercv/__main__.py b/rendercv/__main__.py index 4038a3a..93c15e9 100644 --- a/rendercv/__main__.py +++ b/rendercv/__main__.py @@ -29,13 +29,6 @@ with open(input_file_path) as file: raw_json = yaml.load(file) data = RenderCVDataModel(**raw_json) +output_latex_file=render_template(data=data) -output_latex_file = render_template(data=data) - -# Create an output file and write the rendered LaTeX code to it: -output_file_path = os.path.join(workspace, "tests", "outputs", f"{input_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) - -run_latex(output_file_path) +run_latex(output_latex_file) diff --git a/rendercv/rendering.py b/rendercv/rendering.py index ce8f6ea..a0196c0 100644 --- a/rendercv/rendering.py +++ b/rendercv/rendering.py @@ -1,4 +1,4 @@ -"""This module implements rendering utilities. +"""This module implements LaTeX file generation and LaTeX runner utilities for RenderCV. """ import os import subprocess @@ -89,6 +89,13 @@ def markdown_url_to_url(value: str) -> bool: def render_template(data): + """Render the template using the given data. + + Example: + >>> render_template(data) + + + """ # templates_directory = os.path.dirname(os.path.dirname()) # create a Jinja2 environment: @@ -117,7 +124,15 @@ def render_template(data): environment.filters["markdown_to_latex"] = markdown_to_latex environment.filters["markdown_url_to_url"] = markdown_url_to_url - return template.render(design=data.design.options, cv=data.cv) + 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(os.getcwd(), "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) + + return output_file_path def run_latex(latexFilePath):