From 3bac4eea32c998d56978e1cb7a7f12b0fbdec915 Mon Sep 17 00:00:00 2001 From: Sina Atalay Date: Thu, 6 Jun 2024 17:32:38 +0300 Subject: [PATCH] themes: add new design options (`seperator_between_connections` and `use_icons_for_connections`) --- rendercv/themes/__init__.py | 16 ++++++++++++ rendercv/themes/classic/Header.j2.tex | 23 +++++++++++++++-- .../themes/engineeringresumes/Header.j2.tex | 14 ++++++++--- .../themes/engineeringresumes/__init__.py | 16 ++++++++++++ rendercv/themes/moderncv/Preamble.j2.tex | 4 +-- rendercv/themes/sb2nov/Header.j2.tex | 25 ++++++++++++++++--- 6 files changed, 88 insertions(+), 10 deletions(-) diff --git a/rendercv/themes/__init__.py b/rendercv/themes/__init__.py index b288a7c..ba93f94 100644 --- a/rendercv/themes/__init__.py +++ b/rendercv/themes/__init__.py @@ -280,6 +280,22 @@ class ThemeOptions(pydantic.BaseModel): title="Text Alignment", description="The alignment of the text. The default value is justified.", ) + seperator_between_connections: str = pydantic.Field( + default="", + title="Seperator Between Connections", + description=( + "The separator between the connections in the header. The default value is" + " empty string." + ), + ) + use_icons_for_connections: bool = pydantic.Field( + default=True, + title="Use Icons for Connections", + description=( + "If this option is set to true, then icons will be used for the connections" + " in the header. The default value is true." + ), + ) margins: Margins = pydantic.Field( default=Margins(), title="Margins", diff --git a/rendercv/themes/classic/Header.j2.tex b/rendercv/themes/classic/Header.j2.tex index 940ee5a..022f7b1 100644 --- a/rendercv/themes/classic/Header.j2.tex +++ b/rendercv/themes/classic/Header.j2.tex @@ -1,3 +1,10 @@ +\newcommand{\AND}{\unskip + \cleaders\copy\ANDbox\hskip\wd\ANDbox + \ignorespaces +} +\newsavebox\ANDbox +\sbox\ANDbox{<>} + ((* if not design.disable_last_updated_date *)) \placelastupdatedtext ((* endif *)) @@ -10,12 +17,24 @@ \normalsize ((* for connection in cv.connections *)) + ((* if design.use_icons_for_connections *)) \mbox{((*- if connection["url"] -*)) \hrefWithoutArrow{<>}{{\footnotesize<>}\hspace*{0.13cm}<>} ((*- else -*)) {\footnotesize<>}\hspace*{0.13cm}<> - ((*- endif -*))} - \kern <> + ((*- endif -*))}% + ((* else *)) + \mbox{((*- if connection["url"] -*)) + \hrefWithoutArrow{<>}{<>} + ((*- else -*)) + <> + ((*- endif -*))}% + ((* endif *)) + ((* if not loop.last *)) + \kern <>% + \AND% + \kern <>% + ((* endif *)) ((* endfor *)) \end{header} diff --git a/rendercv/themes/engineeringresumes/Header.j2.tex b/rendercv/themes/engineeringresumes/Header.j2.tex index fc9da31..87026fe 100644 --- a/rendercv/themes/engineeringresumes/Header.j2.tex +++ b/rendercv/themes/engineeringresumes/Header.j2.tex @@ -3,7 +3,7 @@ \ignorespaces } \newsavebox\ANDbox -\sbox\ANDbox{$|$} +\sbox\ANDbox{<>} ((* if not design.disable_last_updated_date *)) \placelastupdatedtext @@ -16,16 +16,24 @@ \normalsize ((* for connection in cv.connections *)) + ((* if design.use_icons_for_connections *)) + \mbox{((*- if connection["url"] -*)) + \hrefWithoutArrow{<>}{{\footnotesize<>}\hspace*{0.13cm}<>} + ((*- else -*)) + {\footnotesize<>}\hspace*{0.13cm}<> + ((*- endif -*))}% + ((* else *)) \mbox{((*- if connection["url"] -*)) \hrefWithoutArrow{<>}{<>} ((*- else -*)) <> ((*- endif -*))}% + ((* endif *)) + ((* if not loop.last *)) \kern <>% - ((* if not loop.last *)) \AND% - ((* endif *)) \kern <>% + ((* endif *)) ((* endfor *)) \end{header} diff --git a/rendercv/themes/engineeringresumes/__init__.py b/rendercv/themes/engineeringresumes/__init__.py index 0716900..6317ef4 100644 --- a/rendercv/themes/engineeringresumes/__init__.py +++ b/rendercv/themes/engineeringresumes/__init__.py @@ -162,6 +162,22 @@ class EngineeringresumesThemeOptions(ThemeOptions): title="Text Alignment", description="The alignment of the text. The default value is left-aligned.", ) + seperator_between_connections: str = pydantic.Field( + default="$|$", + title="Seperator Between Connections", + description=( + "The separator between the connections in the header. The default value is" + " empty string." + ), + ) + use_icons_for_connections: bool = pydantic.Field( + default=False, + title="Use Icons for Connections", + description=( + "If this option is set to true, then icons will be used for the connections" + " (like phone, email, and website). The default value is false." + ), + ) margins: MarginsForEngineeringresumes = pydantic.Field( default=MarginsForEngineeringresumes(), title="Margins", diff --git a/rendercv/themes/moderncv/Preamble.j2.tex b/rendercv/themes/moderncv/Preamble.j2.tex index 4ee650a..c2adc09 100644 --- a/rendercv/themes/moderncv/Preamble.j2.tex +++ b/rendercv/themes/moderncv/Preamble.j2.tex @@ -62,13 +62,13 @@ ((* if cv.social_networks *)) ((* for network in cv.social_networks *)) -\social[<>]{<>} +\social[<>]{<>} ((* endfor *)) ((* endif *)) % Social icons % \social[linkedin]{john.doe} % optional, remove / comment the line if not wanted % \social[xing]{john\_doe} % optional, remove / comment the line if not wanted -% \social[twitter]{ji\_doe} % optional, remove / comment the line if not wanted +% \social[twitter]{ji\_doe} % optional, remove / comment the line if not wanted % \social[github]{jdoe} % optional, remove / comment the line if not wanted % \social[gitlab]{jdoe} % optional, remove / comment the line if not wanted % \social[stackoverflow]{0000000/johndoe} % optional, remove / comment the line if not wanted diff --git a/rendercv/themes/sb2nov/Header.j2.tex b/rendercv/themes/sb2nov/Header.j2.tex index d57b20f..7461c2f 100644 --- a/rendercv/themes/sb2nov/Header.j2.tex +++ b/rendercv/themes/sb2nov/Header.j2.tex @@ -1,3 +1,10 @@ +\newcommand{\AND}{\unskip + \cleaders\copy\ANDbox\hskip\wd\ANDbox + \ignorespaces +} +\newsavebox\ANDbox +\sbox\ANDbox{<>} + ((* if not design.disable_last_updated_date *)) \placelastupdatedtext ((* endif *)) @@ -9,12 +16,24 @@ \normalsize ((* for connection in cv.connections *)) + ((* if design.use_icons_for_connections *)) \mbox{((*- if connection["url"] -*)) \hrefWithoutArrow{<>}{\color{black}{\footnotesize<>}\hspace*{0.13cm}<>} ((*- else -*)) - {\color{black}{\footnotesize<>}\hspace*{0.13cm}<>} - ((*- endif -*))} - \kern <> + {\color{black}\footnotesize<>}\hspace*{0.13cm}<> + ((*- endif -*))}% + ((* else *)) + \mbox{((*- if connection["url"] -*)) + \hrefWithoutArrow{<>}{<>} + ((*- else -*)) + <> + ((*- endif -*))}% + ((* endif *)) + ((* if not loop.last *)) + \kern <>% + \AND% + \kern <>% + ((* endif *)) ((* endfor *)) \end{header}