diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 809801d..b9a03f3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -6,7 +6,7 @@ on: pull_request: branches: ["main"] release: - types: ["published", "edited", "created", "released"] + types: ["published"] jobs: lint: diff --git a/John_Doe_CV.pdf b/John_Doe_CV.pdf index 0c4ba6b..fb6425f 100644 Binary files a/John_Doe_CV.pdf and b/John_Doe_CV.pdf differ diff --git a/John_Doe_CV.yaml b/John_Doe_CV.yaml index d6210e4..fc409c6 100644 --- a/John_Doe_CV.yaml +++ b/John_Doe_CV.yaml @@ -191,20 +191,28 @@ design: - Work Experience - My Other Custom Section show_last_updated_date: True - + text_alignment: justified + header_font_size: 30 pt + margins: page: - top: 1.35 cm - bottom: 1.35 cm - left: 1.35 cm - right: 1.35 cm + top: 2 cm + bottom: 2 cm + left: 1.24 cm + right: 1.24 cm section_title: - top: 0.13 cm - bottom: 0.13 cm + top: 0.2 cm + bottom: 0.2 cm + entry_area: left_and_right: 0.2 cm - vertical_between: 0.12 cm + vertical_between: 0.2 cm + highlights_area: - top: 0.12 cm - left: 0.6 cm - vertical_between_bullet_points: 0.07 cm \ No newline at end of file + top: 0.10 cm + left: 0.4 cm + vertical_between_bullet_points: 0.10 cm + + header: + vertical_between_name_and_connections: 0.2 cm + bottom: 0.2 cm \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 61931ba..d52cb68 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = 'rendercv' description = 'LaTeX CV generator from a YAML/JSON file' -version = '0.8' +version = '0.10' authors = [{ name = 'Sina Atalay' }] requires-python = '>=3.10' readme = "README.md" diff --git a/rendercv/data_model.py b/rendercv/data_model.py index 614f55a..0f31acc 100644 --- a/rendercv/data_model.py +++ b/rendercv/data_model.py @@ -340,22 +340,22 @@ class ClassicThemePageMargins(BaseModel): """This class stores the margins of pages for the classic theme.""" top: LaTeXDimension = Field( - default="1.35 cm", + default="2 cm", title="Top Margin", description="The top margin of the page with units.", ) bottom: LaTeXDimension = Field( - default="1.35 cm", + default="2 cm", title="Bottom Margin", description="The bottom margin of the page with units.", ) left: LaTeXDimension = Field( - default="1.35 cm", + default="1.24 cm", title="Left Margin", description="The left margin of the page with units.", ) right: LaTeXDimension = Field( - default="1.35 cm", + default="1.24 cm", title="Right Margin", description="The right margin of the page with units.", ) @@ -365,12 +365,12 @@ class ClassicThemeSectionTitleMargins(BaseModel): """This class stores the margins of section titles for the classic theme.""" top: LaTeXDimension = Field( - default="0.13 cm", + default="0.2 cm", title="Top Margin", description="The top margin of section titles.", ) bottom: LaTeXDimension = Field( - default="0.13 cm", + default="0.2 cm", title="Bottom Margin", description="The bottom margin of section titles.", ) @@ -401,17 +401,17 @@ class ClassicThemeHighlightsAreaMargins(BaseModel): """This class stores the margins of highlights areas for the classic theme.""" top: LaTeXDimension = Field( - default="0.12 cm", + default="0.10 cm", title="Top Margin", description="The top margin of highlights areas.", ) left: LaTeXDimension = Field( - default="0.6 cm", + default="0.4 cm", title="Left Margin", description="The left margin of highlights areas.", ) vertical_between_bullet_points: LaTeXDimension = Field( - default="0.07 cm", + default="0.10 cm", title="Vertical Margin Between Bullet Points", description="The vertical margin between bullet points.", ) diff --git a/rendercv/rendering.py b/rendercv/rendering.py index 1bd0cea..b220487 100644 --- a/rendercv/rendering.py +++ b/rendercv/rendering.py @@ -127,20 +127,11 @@ def make_it_something( if match_str is not None and not isinstance(match_str, str): raise ValueError("The string to match should be a string!") - if something == "make_it_bold": - keyword = "textbf" - elif something == "make_it_underlined": - keyword = "underline" - elif something == "make_it_italic": - keyword = "textit" - else: - raise ValueError(f"Unknown keyword {something}!") - if match_str is None: - return f"\\{keyword}{{{value}}}" + return f"\\{something}{{{value}}}" if match_str in value: - value = value.replace(match_str, f"\\{keyword}{{{match_str}}}") + value = value.replace(match_str, f"\\{something}{{{match_str}}}") return value else: return value @@ -154,7 +145,7 @@ def make_it_bold(value: str, match_str: Optional[str] = None) -> str: Example: ```python - make_it_bold_if("Hello World!", "Hello") + make_it_bold("Hello World!", "Hello") ``` will return: @@ -165,7 +156,7 @@ def make_it_bold(value: str, match_str: Optional[str] = None) -> str: value (str): The string to make bold. match_str (str): The string to match. """ - return make_it_something(value, "make_it_bold", match_str) + return make_it_something(value, "textbf", match_str) def make_it_underlined(value: str, match_str: Optional[str] = None) -> str: @@ -176,7 +167,7 @@ def make_it_underlined(value: str, match_str: Optional[str] = None) -> str: Example: ```python - make_it_underlined_if("Hello World!", "Hello") + make_it_underlined("Hello World!", "Hello") ``` will return: @@ -187,7 +178,7 @@ def make_it_underlined(value: str, match_str: Optional[str] = None) -> str: value (str): The string to make underlined. match_str (str): The string to match. """ - return make_it_something(value, "make_it_underlined", match_str) + return make_it_something(value, "underline", match_str) def make_it_italic(value: str, match_str: Optional[str] = None) -> str: @@ -198,7 +189,7 @@ def make_it_italic(value: str, match_str: Optional[str] = None) -> str: Example: ```python - make_it_italic_if("Hello World!", "Hello") + make_it_italic("Hello World!", "Hello") ``` will return: @@ -209,7 +200,29 @@ def make_it_italic(value: str, match_str: Optional[str] = None) -> str: value (str): The string to make italic. match_str (str): The string to match. """ - return make_it_something(value, "make_it_italic", match_str) + return make_it_something(value, "textit", match_str) + + +def make_it_nolinebreak(value: str, match_str: Optional[str] = None) -> str: + """Make the matched parts of the string non line breakable. If the match_str is + None, the whole string will be made nonbreakable. + + This function is used as a Jinja2 filter. + + Example: + ```python + make_it_nolinebreak("Hello World!", "Hello") + ``` + + will return: + + `#!python "\\mbox{Hello} World!"` + + Args: + value (str): The string to disable line breaks. + match_str (str): The string to match. + """ + return make_it_something(value, "mbox", match_str) def abbreviate_name(name: list[str]) -> str: @@ -239,32 +252,6 @@ def abbreviate_name(name: list[str]) -> str: return abbreviated_name -def abbreviate_names(names: list[str]) -> str: - """Abbreviate a list of names by keeping the first letters of the first names. - - This function is used as a Jinja2 filter. - - Example: - ```python - abbreviate_names(["John Doe", "Jane Atalay"]) - ``` - - will return: - - `#!python ["J. Doe", "J. Atalay"]` - - Args: - names (list[str]): The names to abbreviate. - Returns: - str: The list of abbreviated names. - """ - abbreviated_names = [] - for name in names: - abbreviated_names.append(abbreviate_name(name)) - - return abbreviated_names - - def divide_length_by(length: str, divider: float) -> str: r"""Divide a length by a number. @@ -278,14 +265,14 @@ def divide_length_by(length: str, divider: float) -> str: def get_today() -> str: - """Return today's date. + """Return today's date in the format of "Month, Year". Returns: str: Today's date. """ today = date.today() - return today.strftime("%B %d, %Y") + return today.strftime("%B, %Y") def get_path_to_font_directory(font_name: str) -> str: @@ -334,9 +321,10 @@ def render_template(data: RenderCVDataModel, output_path: Optional[str] = None) environment.filters["make_it_bold"] = make_it_bold environment.filters["make_it_underlined"] = make_it_underlined environment.filters["make_it_italic"] = make_it_italic + environment.filters["make_it_nolinebreak"] = make_it_nolinebreak + environment.filters["make_it_something"] = make_it_something environment.filters["divide_length_by"] = divide_length_by environment.filters["abbreviate_name"] = abbreviate_name - environment.filters["abbreviate_names"] = abbreviate_names # load the template: template = environment.get_template(f"{theme}.tex.j2") diff --git a/rendercv/templates/classic/classic.tex.j2 b/rendercv/templates/classic/classic.tex.j2 index 28e16a0..2afbd50 100644 --- a/rendercv/templates/classic/classic.tex.j2 +++ b/rendercv/templates/classic/classic.tex.j2 @@ -119,7 +119,7 @@ \LenToUnit{\paperwidth-<>-<>+0.05cm}, \LenToUnit{\paperheight-<>} ){\vtop{{\null}\makebox[0pt][c]{ - \small\color{gray}\textit{Last updated on <>}\hspace{\widthof{Last updated on <>}} + \small\color{gray}\textit{Last updated in <>}\hspace{\widthof{Last updated in <>}} }}}% }% }% diff --git a/rendercv/templates/classic/components/entry.tex.j2 b/rendercv/templates/classic/components/entry.tex.j2 index a068a60..6aea6b8 100644 --- a/rendercv/templates/classic/components/entry.tex.j2 +++ b/rendercv/templates/classic/components/entry.tex.j2 @@ -82,7 +82,7 @@ \vspace{<>} - <> + <> \vspace{<>} diff --git a/rendercv/templates/new_input.yaml.j2 b/rendercv/templates/new_input.yaml.j2 index 71e010b..199c3e1 100644 --- a/rendercv/templates/new_input.yaml.j2 +++ b/rendercv/templates/new_input.yaml.j2 @@ -191,20 +191,28 @@ design: - Work Experience - My Other Custom Section show_last_updated_date: True - + text_alignment: justified + header_font_size: 30 pt + margins: page: - top: 1.35 cm - bottom: 1.35 cm - left: 1.35 cm - right: 1.35 cm + top: 2 cm + bottom: 2 cm + left: 1.24 cm + right: 1.24 cm section_title: - top: 0.13 cm - bottom: 0.13 cm + top: 0.2 cm + bottom: 0.2 cm + entry_area: left_and_right: 0.2 cm - vertical_between: 0.12 cm + vertical_between: 0.2 cm + highlights_area: - top: 0.12 cm - left: 0.6 cm - vertical_between_bullet_points: 0.07 cm \ No newline at end of file + top: 0.10 cm + left: 0.4 cm + vertical_between_bullet_points: 0.10 cm + + header: + vertical_between_name_and_connections: 0.2 cm + bottom: 0.2 cm \ No newline at end of file diff --git a/schema.json b/schema.json index 85f1ada..02a9305 100644 --- a/schema.json +++ b/schema.json @@ -45,21 +45,21 @@ "ClassicThemeHighlightsAreaMargins": { "properties": { "top": { - "default": "0.12 cm", + "default": "0.10 cm", "description": "The top margin of highlights areas.", "pattern": "\\d+\\.?\\d* *(cm|in|pt|mm|ex|em)", "title": "Top Margin", "type": "string" }, "left": { - "default": "0.6 cm", + "default": "0.4 cm", "description": "The left margin of highlights areas.", "pattern": "\\d+\\.?\\d* *(cm|in|pt|mm|ex|em)", "title": "Left Margin", "type": "string" }, "vertical_between_bullet_points": { - "default": "0.07 cm", + "default": "0.10 cm", "description": "The vertical margin between bullet points.", "pattern": "\\d+\\.?\\d* *(cm|in|pt|mm|ex|em)", "title": "Vertical Margin Between Bullet Points", @@ -79,10 +79,10 @@ } ], "default": { - "bottom": "1.35 cm", - "left": "1.35 cm", - "right": "1.35 cm", - "top": "1.35 cm" + "bottom": "2 cm", + "left": "1.24 cm", + "right": "1.24 cm", + "top": "2 cm" }, "description": "Page margins for the classic theme.", "title": "Page Margins" @@ -94,8 +94,8 @@ } ], "default": { - "bottom": "0.13 cm", - "top": "0.13 cm" + "bottom": "0.2 cm", + "top": "0.2 cm" }, "description": "Section title margins for the classic theme.", "title": "Section Title Margins" @@ -120,9 +120,9 @@ } ], "default": { - "left": "0.6 cm", - "top": "0.12 cm", - "vertical_between_bullet_points": "0.07 cm" + "left": "0.4 cm", + "top": "0.10 cm", + "vertical_between_bullet_points": "0.10 cm" }, "description": "Highlights area margins for the classic theme.", "title": "Highlights Area Margins" @@ -215,19 +215,19 @@ "vertical_between_name_and_connections": "0.2 cm" }, "highlights_area": { - "left": "0.6 cm", - "top": "0.12 cm", - "vertical_between_bullet_points": "0.07 cm" + "left": "0.4 cm", + "top": "0.10 cm", + "vertical_between_bullet_points": "0.10 cm" }, "page": { - "bottom": "1.35 cm", - "left": "1.35 cm", - "right": "1.35 cm", - "top": "1.35 cm" + "bottom": "2 cm", + "left": "1.24 cm", + "right": "1.24 cm", + "top": "2 cm" }, "section_title": { - "bottom": "0.13 cm", - "top": "0.13 cm" + "bottom": "0.2 cm", + "top": "0.2 cm" } }, "description": "Page, section title, entry field, and highlights field margins.", @@ -241,28 +241,28 @@ "ClassicThemePageMargins": { "properties": { "top": { - "default": "1.35 cm", + "default": "2 cm", "description": "The top margin of the page with units.", "pattern": "\\d+\\.?\\d* *(cm|in|pt|mm|ex|em)", "title": "Top Margin", "type": "string" }, "bottom": { - "default": "1.35 cm", + "default": "2 cm", "description": "The bottom margin of the page with units.", "pattern": "\\d+\\.?\\d* *(cm|in|pt|mm|ex|em)", "title": "Bottom Margin", "type": "string" }, "left": { - "default": "1.35 cm", + "default": "1.24 cm", "description": "The left margin of the page with units.", "pattern": "\\d+\\.?\\d* *(cm|in|pt|mm|ex|em)", "title": "Left Margin", "type": "string" }, "right": { - "default": "1.35 cm", + "default": "1.24 cm", "description": "The right margin of the page with units.", "pattern": "\\d+\\.?\\d* *(cm|in|pt|mm|ex|em)", "title": "Right Margin", @@ -276,14 +276,14 @@ "ClassicThemeSectionTitleMargins": { "properties": { "top": { - "default": "0.13 cm", + "default": "0.2 cm", "description": "The top margin of section titles.", "pattern": "\\d+\\.?\\d* *(cm|in|pt|mm|ex|em)", "title": "Top Margin", "type": "string" }, "bottom": { - "default": "0.13 cm", + "default": "0.2 cm", "description": "The bottom margin of section titles.", "pattern": "\\d+\\.?\\d* *(cm|in|pt|mm|ex|em)", "title": "Bottom Margin", @@ -1632,19 +1632,19 @@ "vertical_between_name_and_connections": "0.2 cm" }, "highlights_area": { - "left": "0.6 cm", - "top": "0.12 cm", - "vertical_between_bullet_points": "0.07 cm" + "left": "0.4 cm", + "top": "0.10 cm", + "vertical_between_bullet_points": "0.10 cm" }, "page": { - "bottom": "1.35 cm", - "left": "1.35 cm", - "right": "1.35 cm", - "top": "1.35 cm" + "bottom": "2 cm", + "left": "1.24 cm", + "right": "1.24 cm", + "top": "2 cm" }, "section_title": { - "bottom": "0.13 cm", - "top": "0.13 cm" + "bottom": "0.2 cm", + "top": "0.2 cm" } }, "primary_color": "#004f90", diff --git a/tests/reference_files/John_Doe_CV_pdf_reference.pdf b/tests/reference_files/John_Doe_CV_pdf_reference.pdf index 51d3bae..fb6425f 100644 Binary files a/tests/reference_files/John_Doe_CV_pdf_reference.pdf and b/tests/reference_files/John_Doe_CV_pdf_reference.pdf differ diff --git a/tests/reference_files/John_Doe_CV_tex_reference.tex b/tests/reference_files/John_Doe_CV_tex_reference.tex index 6204dfc..74af2ed 100644 --- a/tests/reference_files/John_Doe_CV_tex_reference.tex +++ b/tests/reference_files/John_Doe_CV_tex_reference.tex @@ -4,11 +4,11 @@ % Packages: \usepackage[ ignoreheadfoot, % set margins without considering header and footer - top=1.35 cm, % seperation between body and page edge from the top - bottom=1.35 cm, % seperation between body and page edge from the bottom - left=1.35 cm, % seperation between body and page edge from the left - right=1.35 cm, % seperation between body and page edge from the right - footskip=0.675 cm, % seperation between body and footer + top=2 cm, % seperation between body and page edge from the top + bottom=2 cm, % seperation between body and page edge from the bottom + left=1.24 cm, % seperation between body and page edge from the left + right=1.24 cm, % seperation between body and page edge from the right + footskip=1.0 cm, % seperation between body and footer % showframe % for debugging ]{geometry} % for adjusting page geometry \usepackage{fontspec} % for loading fonts @@ -68,10 +68,10 @@ 0pt }{ % top space: - 0.13 cm + 0.2 cm }{ % bottom space: - 0.13 cm + 0.2 cm } % section title spacing \newcolumntype{L}[1]{ @@ -81,17 +81,17 @@ >{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}p{#1} } % right-aligned fixed width column type \newcolumntype{K}[1]{ - >{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}X -} % left-aligned flexible width column type + >{\let\newline\\\arraybackslash\hspace{0pt}}X +} % justified flexible width column type \setlength\tabcolsep{-1.5pt} % no space between columns \newenvironment{highlights}{ \begin{itemize}[ topsep=0pt, - parsep=0.07 cm, + parsep=0.10 cm, partopsep=0pt, itemsep=0pt, after=\vspace{-1\baselineskip}, - leftmargin=0.6 cm + 3pt + leftmargin=0.4 cm + 3pt ] }{ \end{itemize} @@ -106,10 +106,10 @@ \newcommand{\placelastupdatedtext}{% \placetextbox{}{}{} \AddToShipoutPictureFG*{% Add to current page foreground \put( - \LenToUnit{\paperwidth-1.35 cm-0.2 cm+0.05cm}, - \LenToUnit{\paperheight-0.675 cm} + \LenToUnit{\paperwidth-1.24 cm-0.2 cm+0.05cm}, + \LenToUnit{\paperheight-1.0 cm} ){\vtop{{\null}\makebox[0pt][c]{ - \small\color{gray}\textit{Last updated on November 27, 2023}\hspace{\widthof{Last updated on November 27, 2023}} + \small\color{gray}\textit{Last updated in November, 2023}\hspace{\widthof{Last updated in November, 2023}} }}}% }% }% @@ -147,7 +147,6 @@ \section{Summary} { - \raggedright \setlength{\leftskip}{0.2 cm} \setlength{\rightskip}{0.2 cm} @@ -164,7 +163,7 @@ \textbf{BS} & \textbf{My University}, Mechanical Engineering - \vspace{0.12 cm} + \vspace{0.10 cm} \begin{highlights} \item GPA: 3.99/4.00 (\href{https://example.com/}{Transcript}) \item Class rank: 1 of 62 \hspace*{-0.2cm} @@ -174,12 +173,12 @@ Sept. 2017 to Jan. 2023 \end{tabularx} - \vspace{0.12 cm} + \vspace{0.2 cm} \begin{tabularx}{\textwidth-0.4 cm-0.13cm}{L{0.85cm} K{0.2 cm} R{3.6 cm}} \textbf{} & \textbf{The University of Texas at Austin}, Mechanical Engineering, Student Exchange Program - \vspace{0.12 cm} + \vspace{0.10 cm} \begin{highlights} \item GPA: 4.00/4.00 (\href{https://example.com/}{Transcript}) \hspace*{-0.2cm} \end{highlights} @@ -194,7 +193,7 @@ \begin{tabularx}{\textwidth-0.4 cm-0.13cm}{K{0.2 cm} R{3.6 cm}} \textbf{CERN}, Mechanical Engineer - \vspace{0.12 cm} + \vspace{0.10 cm} \begin{highlights} \item CERN is a research organization that operates the world's largest and most powerful particle accelerator. \item Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. @@ -206,10 +205,10 @@ 10 months \end{tabularx} - \vspace{0.12 cm} + \vspace{0.2 cm} \begin{tabularx}{\textwidth-0.4 cm-0.13cm}{K{0.2 cm} R{3.6 cm}} \textbf{AmIACompany}, Summer Intern - \vspace{0.12 cm} + \vspace{0.10 cm} \begin{highlights} \item AmIACompany is a technology company that provides web-based engineering applications that enable the simulation and optimization of products and manufacturing tools. \item Modeled and simulated a metal-forming process deep drawing using finite element analysis with open-source software called CalculiX. \hspace*{-0.2cm} @@ -226,7 +225,7 @@ \begin{tabularx}{\textwidth-0.4 cm-0.13cm}{K{0.2 cm} R{3.6 cm}} \textbf{Design and Construction of a Robot}, \href{https://example.com/}{view on my website} - \vspace{0.12 cm} + \vspace{0.10 cm} \begin{highlights} \item Designed and constructed a controllable robot that measures a car's torque and power output at different speeds for my senior design project. \hspace*{-0.2cm} \end{highlights} @@ -235,10 +234,10 @@ Fall 2022 \end{tabularx} - \vspace{0.12 cm} + \vspace{0.2 cm} \begin{tabularx}{\textwidth-0.4 cm-0.13cm}{K{0.2 cm} R{3.6 cm}} \textbf{Design and Construction of an Another Robot}, \href{https://example.com/}{view on my website} - \vspace{0.12 cm} + \vspace{0.10 cm} \begin{highlights} \item Designed, built, and programmed a microcontroller-based device that plays a guitar with DC motors as part of a mechatronics course term project. \hspace*{-0.2cm} \end{highlights} @@ -253,7 +252,7 @@ \begin{tabularx}{\textwidth-0.4 cm-0.13cm}{K{0.2 cm} R{3.6 cm}} \textbf{Machine Learning by Stanford University}, \href{https://example.com/}{Certificate} - \vspace{0.12 cm} + \vspace{0.10 cm} & Sept. 2022 \end{tabularx} @@ -264,7 +263,7 @@ \begin{tabularx}{\textwidth-0.4 cm-0.13cm}{K{0.2 cm} R{3.6 cm}} \textbf{Ray Tracing in C++}, \href{https://example.com/}{view on my website} - \vspace{0.12 cm} + \vspace{0.10 cm} \begin{highlights} \item Coded a ray tracer in C++ that can render scenes with multiple light sources, spheres, and planes with reflection and refraction properties. \hspace*{-0.2cm} \end{highlights} @@ -276,7 +275,7 @@ \section{Skills} - \begingroup\raggedright \leftskip=0.2 cm + \begingroup \leftskip=0.2 cm \advance\csname @rightskip\endcsname 0.2 cm \advance\rightskip 0.2 cm @@ -284,8 +283,8 @@ \par\endgroup - \vspace{0.12 cm} - \begingroup\raggedright \leftskip=0.2 cm + \vspace{0.2 cm} + \begingroup \leftskip=0.2 cm \advance\csname @rightskip\endcsname 0.2 cm \advance\rightskip 0.2 cm @@ -293,8 +292,8 @@ \par\endgroup - \vspace{0.12 cm} - \begingroup\raggedright \leftskip=0.2 cm + \vspace{0.2 cm} + \begingroup \leftskip=0.2 cm \advance\csname @rightskip\endcsname 0.2 cm \advance\rightskip 0.2 cm @@ -302,8 +301,8 @@ \par\endgroup - \vspace{0.12 cm} - \begingroup\raggedright \leftskip=0.2 cm + \vspace{0.2 cm} + \begingroup \leftskip=0.2 cm \advance\csname @rightskip\endcsname 0.2 cm \advance\rightskip 0.2 cm @@ -315,7 +314,7 @@ \section{Test Scores} - \begingroup\raggedright \leftskip=0.2 cm + \begingroup \leftskip=0.2 cm \advance\csname @rightskip\endcsname 0.2 cm \advance\rightskip 0.2 cm @@ -323,8 +322,8 @@ \par\endgroup - \vspace{0.12 cm} - \begingroup\raggedright \leftskip=0.2 cm + \vspace{0.2 cm} + \begingroup \leftskip=0.2 cm \advance\csname @rightskip\endcsname 0.2 cm \advance\rightskip 0.2 cm @@ -338,7 +337,7 @@ \begin{tabularx}{\textwidth-0.4 cm-0.13cm}{K{0.2 cm} R{3.6 cm}} \textbf{Dumanlikiz Skiing Club}, Co-founder / Skiing Instructor - \vspace{0.12 cm} + \vspace{0.10 cm} \begin{highlights} \item Taught skiing during winters as a certified skiing instructor. \hspace*{-0.2cm} \end{highlights} @@ -354,11 +353,11 @@ \begin{tabularx}{\textwidth-0.4 cm-0.13cm}{K{0.2 cm} R{3.6 cm}} \textbf{Phononic band gaps induced by inertial amplification in periodic media} - \vspace{0.07 cm} + \vspace{0.10 cm} - A. \nolinebreak 1, J. \nolinebreak Doe, A. \nolinebreak 3 + \mbox{A. 1}, \mbox{\textbf{\textit{J. Doe}}}, \mbox{A. 3} - \vspace{0.07 cm} + \vspace{0.10 cm} \href{https://doi.org/10.1103/PhysRevB.76.054309}{10.1103/PhysRevB.76.054309} (Physical Review B) & @@ -370,7 +369,7 @@ \section{My Custom Section} - \begingroup\raggedright \leftskip=0.2 cm + \begingroup \leftskip=0.2 cm \advance\csname @rightskip\endcsname 0.2 cm \advance\rightskip 0.2 cm @@ -378,8 +377,8 @@ \par\endgroup - \vspace{0.12 cm} - \begingroup\raggedright \leftskip=0.2 cm + \vspace{0.2 cm} + \begingroup \leftskip=0.2 cm \advance\csname @rightskip\endcsname 0.2 cm \advance\rightskip 0.2 cm @@ -395,7 +394,7 @@ \textbf{HA} & \textbf{Hop!}, Hop! - \vspace{0.12 cm} + \vspace{0.10 cm} \begin{highlights} \item There are only five types of entries: \textit{EducationEntry}, \textit{ExperienceEntry}, \textit{NormalEntry}, \textit{OneLineEntry}, and \textit{PublicationEntry}. \item This is an EducationEntry! \hspace*{-0.2cm} @@ -411,7 +410,7 @@ \begin{tabularx}{\textwidth-0.4 cm-0.13cm}{K{0.2 cm} R{3.6 cm}} \textbf{Hop!}, Hop! - \vspace{0.12 cm} + \vspace{0.10 cm} \begin{highlights} \item I think this is really working. This is an \textit{ExperienceEntry}! \hspace*{-0.2cm} \end{highlights} @@ -426,7 +425,7 @@ \begin{tabularx}{\textwidth-0.4 cm-0.13cm}{K{0.2 cm}} \textbf{This is a normal entry!}, \href{https://example.com/}{My Link Text} - \vspace{0.12 cm} + \vspace{0.10 cm} \begin{highlights} \item You don't have to specify a \textit{date} or \textbf{location} every time. \item You can use \textit{Markdown} in the \textbf{highlights}! diff --git a/tests/reference_files/John_Doe_CV_yaml_reference.yaml b/tests/reference_files/John_Doe_CV_yaml_reference.yaml index d6210e4..fc409c6 100644 --- a/tests/reference_files/John_Doe_CV_yaml_reference.yaml +++ b/tests/reference_files/John_Doe_CV_yaml_reference.yaml @@ -191,20 +191,28 @@ design: - Work Experience - My Other Custom Section show_last_updated_date: True - + text_alignment: justified + header_font_size: 30 pt + margins: page: - top: 1.35 cm - bottom: 1.35 cm - left: 1.35 cm - right: 1.35 cm + top: 2 cm + bottom: 2 cm + left: 1.24 cm + right: 1.24 cm section_title: - top: 0.13 cm - bottom: 0.13 cm + top: 0.2 cm + bottom: 0.2 cm + entry_area: left_and_right: 0.2 cm - vertical_between: 0.12 cm + vertical_between: 0.2 cm + highlights_area: - top: 0.12 cm - left: 0.6 cm - vertical_between_bullet_points: 0.07 cm \ No newline at end of file + top: 0.10 cm + left: 0.4 cm + vertical_between_bullet_points: 0.10 cm + + header: + vertical_between_name_and_connections: 0.2 cm + bottom: 0.2 cm \ No newline at end of file diff --git a/tests/test_rendering.py b/tests/test_rendering.py index d4a246e..e6a74e4 100644 --- a/tests/test_rendering.py +++ b/tests/test_rendering.py @@ -95,10 +95,14 @@ class TestRendering(unittest.TestCase): def test_make_it_something(self): # invalid input: input = "test" - keyword = "invalid keyword" - with self.subTest(msg="invalid keyword"): - with self.assertRaises(ValueError): - rendering.make_it_something(input, keyword) + something = "haha" + result = rendering.make_it_something(input, something) + with self.subTest(msg="match_str is none"): + self.assertEqual(result, "\\haha{test}") + + result = rendering.make_it_something(input, something, match_str="te") + with self.subTest(msg="match_str is not none"): + self.assertEqual(result, "\\haha{te}st") def test_make_it_bold(self): input = "some text" @@ -184,7 +188,7 @@ class TestRendering(unittest.TestCase): self.assertEqual(rendering.divide_length_by(length, divider), exp) def test_get_today(self): - expected = date.today().strftime("%B %d, %Y") + expected = date.today().strftime("%B, %Y") result = rendering.get_today() self.assertEqual(expected, result, msg="Today's date is not correct.")