diff --git a/rendercv/data_model.py b/rendercv/data_model.py index d3203e3..0845a0d 100644 --- a/rendercv/data_model.py +++ b/rendercv/data_model.py @@ -31,6 +31,7 @@ from pydantic_extra_types.color import Color from spellchecker import SpellChecker +logger = logging.getLogger(__name__) # ====================================================================================== # HELPERS ============================================================================== # ====================================================================================== @@ -96,7 +97,7 @@ def check_spelling(sentence: str) -> str: if word in dictionary: continue - logging.warning( + logger.warning( f'The word "{word}" might be misspelled according to the' " pyspellchecker." ) @@ -546,14 +547,14 @@ class Event(BaseModel): end_date_is_provided = True if date_is_provided and start_date_is_provided and end_date_is_provided: - logging.warning( + logger.warning( '"start_date", "end_date" and "date" are all provided in of the' " entries. Therefore, date will be ignored." ) model.date = None elif date_is_provided and start_date_is_provided and not end_date_is_provided: - logging.warning( + logger.warning( 'Both "date" and "start_date" is provided in of the entries.' ' "start_date" will be ignored.' ) @@ -561,7 +562,7 @@ class Event(BaseModel): model.end_date = None elif date_is_provided and end_date_is_provided and not start_date_is_provided: - logging.warning( + logger.warning( 'Both "date" and "end_date" is provided in of the entries. "end_date"' " will be ignored." ) @@ -569,7 +570,7 @@ class Event(BaseModel): model.end_date = None elif start_date_is_provided and not end_date_is_provided: - logging.warning( + logger.warning( '"start_date" is provided in of the entries, but "end_date" is not.' ' "end_date" will be set to "present".' ) diff --git a/rendercv/templates/components/classic/entry.tex.j2 b/rendercv/templates/components/classic/entry.tex.j2 index ebf794d..3a7ce8d 100644 --- a/rendercv/templates/components/classic/entry.tex.j2 +++ b/rendercv/templates/components/classic/entry.tex.j2 @@ -41,7 +41,7 @@ \begin{tabularx}{\textwidth}{K{<>} R{<>}} ((* if markdown_url is not none *)) ((* if link_text is not none *)) - ((* set markdown_url = "["+link_text+"]("+ markdown_url|markdown_url_to_url +")" *)) + ((* set markdown_url = "["+link_text+"]("+ markdown_url|markdown_link_to_url +")" *)) \textbf{<>}, <> ((* else *)) \textbf{<>}, <> @@ -77,7 +77,7 @@ ((* if markdown_url is not none *)) ((* if link_text is not none *)) - ((* set markdown_url = "["+link_text+"]("+ markdown_url|markdown_url_to_url +")" *)) + ((* set markdown_url = "["+link_text+"]("+ markdown_url|markdown_link_to_url +")" *)) \textbf{<>:} <
> (<>) ((* else *)) \textbf{<>:} <
> (<>) diff --git a/tests/reference_files/John_Doe_CV.tex b/tests/reference_files/John_Doe_CV.tex new file mode 100644 index 0000000..aec48cd --- /dev/null +++ b/tests/reference_files/John_Doe_CV.tex @@ -0,0 +1,321 @@ + +\documentclass[10pt, a4paper]{article} + +% 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 + % showframe % for debugging + ]{geometry} % for adjusting page geometry +\usepackage{fontspec} % for loading fonts +\usepackage[explicit]{titlesec} % for customizing section titles +\usepackage{tabularx} % for making tables with fixed width columns +\usepackage{array} % tabularx requires this +\usepackage[dvipsnames]{xcolor} % for coloring text +\definecolor{primaryColor}{RGB}{0, 79, 144} % define primary color +\usepackage{enumitem} % for customizing lists +\usepackage{fontawesome5} % for using icons +\usepackage[ + pdftitle={John Doe's CV}, + pdfauthor={John Doe}, + colorlinks=true, + urlcolor=primaryColor +]{hyperref} % for links, metadata and bookmarks +\usepackage[pscoord]{eso-pic} % for floating text on the page +\usepackage{calc} % for calculating lengths + +% Some settings: +\pagestyle{empty} % no header or footer +\setcounter{secnumdepth}{0} % no section numbering +\setlength{\parindent}{0pt} % no indentation +\setlength{\topskip}{0pt} % no top skip +\pagenumbering{gobble} % no page numbering + + +\setmainfont{EBGaramond}[ + Path= fonts/, + Extension = .ttf, + UprightFont = *-Regular, + ItalicFont = *-Italic, + BoldFont = *-Bold, + BoldItalicFont = *-BoldItalic +] + +\titleformat{\section}{ + % make the font size of the section title large and color it with the primary color + \Large\color{primaryColor} + }{ + }{ + }{ + % print bold title, give 0.15 cm space and draw a line of 0.8 pt thickness + % from the end of the title to the end of the body + \textbf{#1}\hspace{0.15cm}\titlerule[0.8pt] + }[] % section title formatting + +\titlespacing{\section}{ + % left space: + 0pt + }{ + % top space: + 0.13 cm + }{ + % bottom space: + 0.13 cm + } % section title spacing + +\newcolumntype{L}[1]{ + >{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}p{#1} +} % left-aligned fixed width column type +\newcolumntype{R}[1]{ + >{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}p{#1} +} % right-aligned fixed width column type +\newcolumntype{K}[1]{ + >{\raggedright\let\newline\\\arraybackslash\hspace{-0.2cm}\hspace{#1}}X +} % left-aligned flexible width column type + +\newenvironment{highlights}{ + \begin{itemize}[ + topsep=0pt, + parsep=0.07 cm, + partopsep=0pt, + itemsep=0pt, + after=\vspace*{-1\baselineskip}, + leftmargin=0.6 cm + 3pt + ] + }{ + \end{itemize} + } % new environment for highlights + +\newenvironment{header}{ + \setlength{\topsep}{0pt}\par\kern\topsep\centering\color{primaryColor}\linespread{1.5} + }{ + \par\kern\topsep + } % new environment for the header + +\newcommand{\placelastupdatedtext}{% \placetextbox{}{}{} + \AddToShipoutPictureFG*{% Add to current page foreground + \put( + \LenToUnit{\paperwidth-1.35 cm}, + \LenToUnit{\paperheight-0.675 cm} + ){\vtop{{\null}\makebox[0pt][c]{ + \small\color{gray}\emph{Last updated on October 08, 2023} \hspace{\widthof{Last updated on October 08, 2023}} + }}}% + }% +}% + +\newcommand{\hrefExternal}[2]{\href{#1}{#2\, \raisebox{.1ex}{\footnotesize \faExternalLink*}}} % new command for external links + +\begin{document} + \placelastupdatedtext + + \begin{header} + \Huge + \textbf{John Doe} + + \normalsize + \mbox{{\small\faMapMarker*}\hspace{0.13cm}Geneva, Switzerland} + \hspace{0.5cm} + \mbox{\href{tel:+905413769286}{{\footnotesize\faPhone*}\hspace{0.13cm}+90 541 376 92 86}} + \hspace{0.5cm} + \mbox{\href{mailto:john@doe.com}{{\small\faEnvelope[regular]}\hspace{0.13cm}john@doe.com}} + \hspace{0.5cm} + \mbox{\href{https://example.com/}{{\small\faLink}\hspace{0.13cm}example.com}} + \hspace{0.5cm} + \mbox{\href{https://www.linkedin.com/in/dummy}{{\small\faLinkedinIn}\hspace{0.13cm}dummy}} + \hspace{0.5cm} + \mbox{\href{https://www.github.com/sinaatalay}{{\small\faGithub}\hspace{0.13cm}sinaatalay}} + \end{header} + + + \section{Education} + \begin{tabularx}{\textwidth}{p{0.55cm} K{0.2 cm} R{3.6 cm}} + \textbf{BS} + & + \textbf{Bogazici University}, Mechanical Engineering + \vspace*{0.12 cm} + \begin{highlights} + \item GPA: 3.80/4.00 (\hrefExternal{https://example.com/}{Transcript}) + \item Test 1 + \item Test 2 + \end{highlights} + & + Istanbul, Turkey \hspace*{-0.2cm + 0.2 cm} \newline + Sept. 1980 to Jan. 1985 \hspace*{-0.2cm + 0.2 cm} + \end{tabularx} + + \vspace*{0.12 cm} + + \begin{tabularx}{\textwidth}{p{0.55cm} 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} + & + Austin, TX, USA \hspace*{-0.2cm + 0.2 cm} \newline + Aug. 2021 to Jan. 2022 \hspace*{-0.2cm + 0.2 cm} + \end{tabularx} + + + \section{Work Experience} + \begin{tabularx}{\textwidth}{K{0.2 cm} R{3.6 cm}} + \textbf{Company 1}, Position 1 + \vspace*{0.12 cm} + \begin{highlights} + \item Test 1 + \item Test 2 + \item Test 3 + \end{highlights} + & + Geneva, Switzerland \hspace*{-0.2cm + 0.2 cm} \newline + Feb. 2023 to present \hspace*{-0.2cm + 0.2 cm} \newline + 8 months \hspace*{-0.2cm + 0.2 cm} + \end{tabularx} + + \vspace*{0.12 cm} + + \begin{tabularx}{\textwidth}{K{0.2 cm} R{3.6 cm}} + \textbf{Company 2}, Position 2 + \vspace*{0.12 cm} + \begin{highlights} + \item Test 1 + \item Test 2 + \item Test 3 + \end{highlights} + & + Geneva, Switzerland \hspace*{-0.2cm + 0.2 cm} \newline + Feb. 1986 to Feb. 2023 \hspace*{-0.2cm + 0.2 cm} \newline + 37 years 1 month \hspace*{-0.2cm + 0.2 cm} + \end{tabularx} + + + \section{Academic Projects} + \begin{tabularx}{\textwidth}{K{0.2 cm} R{3.6 cm}} + \textbf{Academic Project 1}, \hrefExternal{https://example.com/}{view on my website} + \vspace*{0.12 cm} + \begin{highlights} + \item Test 1 + \item Test 2 + \end{highlights} + & + Istanbul, Turkey \hspace*{-0.2cm + 0.2 cm} \newline + Spring 2022 \hspace*{-0.2cm + 0.2 cm} + \end{tabularx} + + \vspace*{0.12 cm} + + \begin{tabularx}{\textwidth}{K{0.2 cm} R{3.6 cm}} + \textbf{Academic Project 2}, \hrefExternal{https://example.com/}{view on my website} + \vspace*{0.12 cm} + \begin{highlights} + \item Test 1 + \item Test 2 + \end{highlights} + & + \end{tabularx} + + \vspace*{0.12 cm} + + \begin{tabularx}{\textwidth}{K{0.2 cm} R{3.6 cm}} + \textbf{Academic Project 3}, \hrefExternal{https://example.com/}{view on my website} + \vspace*{0.12 cm} + \begin{highlights} + \item Test 1 + \item Test 2 + \end{highlights} + & + Istanbul, Turkey \hspace*{-0.2cm + 0.2 cm} \newline + Feb. 2022 to May 2022 \hspace*{-0.2cm + 0.2 cm} + \end{tabularx} + + + \section{Certificates} + \begin{tabularx}{\textwidth}{K{0.2 cm} R{3.6 cm}} + \textbf{Certificate 1} + \vspace*{0.12 cm} + & + \end{tabularx} + + + \section{Personal Projects} + \begin{tabularx}{\textwidth}{K{0.2 cm} R{3.6 cm}} + \textbf{Personal Project 1} + \vspace*{0.12 cm} + & + \end{tabularx} + + + \section{Skills} + \setlength{\leftskip}{0.2cm} + + \textbf{Programming:} C++, C, Python, JavaScript, MATLAB, Lua, LaTeX + + \setlength{\leftskip}{0cm} + + \vspace*{0.12 cm} + + \setlength{\leftskip}{0.2cm} + + \textbf{CAE:} GMSH, GetDP, CalculiX + + \setlength{\leftskip}{0cm} + + + \section{Test Scores} + \setlength{\leftskip}{0.2cm} + + \textbf{TOEFL:} 120/120 + + \setlength{\leftskip}{0cm} + + \vspace*{0.12 cm} + + \setlength{\leftskip}{0.2cm} + + \textbf{IELTS:} 9.0/9.0 (\hrefExternal{https://example.com/}{view on my website}) + + \setlength{\leftskip}{0cm} + + + \section{Extracurricular Activities} + \begin{tabularx}{\textwidth}{K{0.2 cm} R{3.6 cm}} + \textbf{Test Company 1}, Test Position 1 + \vspace*{0.12 cm} + \begin{highlights} + \item Lead and train members for intercollegiate alpine ski races in Turkey and organize skiing events. + \end{highlights} + & + \end{tabularx} + + \vspace*{0.12 cm} + + \begin{tabularx}{\textwidth}{K{0.2 cm} R{3.6 cm}} + \textbf{Test Company 1}, Test Position 1 + \vspace*{0.12 cm} + \begin{highlights} + \item Test 1 + \item Test 2 + \item Test 3 + \end{highlights} + & + Izmir, Turkey \hspace*{-0.2cm + 0.2 cm} \newline + Summer 2019 and 2020 \hspace*{-0.2cm + 0.2 cm} + \end{tabularx} + + + \section{Publications} + \begin{tabularx}{\textwidth}{K{0.2 cm} R{2 cm}} + \textbf{Phononic band gaps induced by inertial amplification in periodic media} + + Cetin Yilmaz, Gregory M Hulbert, Noboru Kikuchi + + DOI: \hrefExternal{https://doi.org/10.1103/PhysRevB.76.054309}{10.1103/PhysRevB.76.054309} + & + Aug. 2007 + \end{tabularx} + + + +\end{document} \ No newline at end of file diff --git a/tests/test_rendercv.py b/tests/test_data_model.py similarity index 99% rename from tests/test_rendercv.py rename to tests/test_data_model.py index 6cbbda6..efb998e 100644 --- a/tests/test_rendercv.py +++ b/tests/test_data_model.py @@ -1,12 +1,12 @@ import unittest -from rendercv import data_model, rendering + +from rendercv import data_model from datetime import date as Date from pydantic import ValidationError -from pydantic_core import Url -class TestRendercv(unittest.TestCase): +class TestDataModel(unittest.TestCase): def test_check_spelling(self): sentences = [ "This is a sentence.",