fix documentation

This commit is contained in:
Sina Atalay 2023-09-13 19:10:21 +02:00
parent 7ea2710fc4
commit 9748912f21
12 changed files with 54 additions and 24 deletions

View File

@ -0,0 +1,5 @@
---
hide:
- navigation
---
test

View File

@ -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.

View File

@ -0,0 +1,3 @@
# Rendering
::: rendercv.rendering

View File

@ -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. It's a work in progress, please come back later.

View File

@ -1 +0,0 @@
Test

View File

@ -1,2 +0,0 @@
# TinyTeX
::: rendercv.tinytex

View File

@ -43,11 +43,11 @@ theme:
nav: nav:
- Quick Start: index.md - Quick Start: index.md
- Contact: contact.md - Contact: contact.md
- Code Reference: - Code Documentation:
- Code Reference: reference/index.md - Code Reference: documentation/index.md
- __main__.py: reference/__main__.md - __main__.py: documentation/__main__.md
- data_model.py: reference/data_model.md - data_model.py: documentation/data_model.md
- rendering.py: reference/rendering.md - rendering.py: documentation/rendering.md
plugins: plugins:
- search - search

View File

@ -1,4 +1,4 @@
"""RenderCV package """RenderCV package.
A Python application that creates a CV in PDF from a YAML/JSON input 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/).
""" """

View File

@ -29,13 +29,6 @@ with open(input_file_path) as file:
raw_json = yaml.load(file) raw_json = yaml.load(file)
data = RenderCVDataModel(**raw_json) data = RenderCVDataModel(**raw_json)
output_latex_file=render_template(data=data)
output_latex_file = render_template(data=data) run_latex(output_latex_file)
# 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)

View File

@ -1,4 +1,4 @@
"""This module implements rendering utilities. """This module implements LaTeX file generation and LaTeX runner utilities for RenderCV.
""" """
import os import os
import subprocess import subprocess
@ -89,6 +89,13 @@ def markdown_url_to_url(value: str) -> bool:
def render_template(data): def render_template(data):
"""Render the template using the given data.
Example:
>>> render_template(data)
"""
# templates_directory = os.path.dirname(os.path.dirname()) # templates_directory = os.path.dirname(os.path.dirname())
# create a Jinja2 environment: # create a Jinja2 environment:
@ -117,7 +124,15 @@ def render_template(data):
environment.filters["markdown_to_latex"] = markdown_to_latex environment.filters["markdown_to_latex"] = markdown_to_latex
environment.filters["markdown_url_to_url"] = markdown_url_to_url 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): def run_latex(latexFilePath):