themes: add new design options (`seperator_between_connections` and `use_icons_for_connections`)

This commit is contained in:
Sina Atalay 2024-06-06 17:32:38 +03:00
parent 9deb39246d
commit 3bac4eea32
6 changed files with 88 additions and 10 deletions

View File

@ -280,6 +280,22 @@ class ThemeOptions(pydantic.BaseModel):
title="Text Alignment", title="Text Alignment",
description="The alignment of the text. The default value is justified.", 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( margins: Margins = pydantic.Field(
default=Margins(), default=Margins(),
title="Margins", title="Margins",

View File

@ -1,3 +1,10 @@
\newcommand{\AND}{\unskip
\cleaders\copy\ANDbox\hskip\wd\ANDbox
\ignorespaces
}
\newsavebox\ANDbox
\sbox\ANDbox{<<design.seperator_between_connections>>}
((* if not design.disable_last_updated_date *)) ((* if not design.disable_last_updated_date *))
\placelastupdatedtext \placelastupdatedtext
((* endif *)) ((* endif *))
@ -10,12 +17,24 @@
\normalsize \normalsize
((* for connection in cv.connections *)) ((* for connection in cv.connections *))
((* if design.use_icons_for_connections *))
\mbox{((*- if connection["url"] -*)) \mbox{((*- if connection["url"] -*))
\hrefWithoutArrow{<<connection["url"]>>}{{\footnotesize<<connection["latex_icon"]>>}\hspace*{0.13cm}<<connection["placeholder"]|escape_latex_characters>>} \hrefWithoutArrow{<<connection["url"]>>}{{\footnotesize<<connection["latex_icon"]>>}\hspace*{0.13cm}<<connection["placeholder"]|escape_latex_characters>>}
((*- else -*)) ((*- else -*))
{\footnotesize<<connection["latex_icon"]>>}\hspace*{0.13cm}<<connection["placeholder"]|escape_latex_characters>> {\footnotesize<<connection["latex_icon"]>>}\hspace*{0.13cm}<<connection["placeholder"]|escape_latex_characters>>
((*- endif -*))} ((*- endif -*))}%
\kern <<design.margins.header.horizontal_between_connections>> ((* else *))
\mbox{((*- if connection["url"] -*))
\hrefWithoutArrow{<<connection["url"]>>}{<<connection["clean_url"]|escape_latex_characters>>}
((*- else -*))
<<connection["placeholder"]|escape_latex_characters>>
((*- endif -*))}%
((* endif *))
((* if not loop.last *))
\kern <<design.margins.header.horizontal_between_connections|divide_length_by(2)>>%
\AND%
\kern <<design.margins.header.horizontal_between_connections|divide_length_by(2)>>%
((* endif *))
((* endfor *)) ((* endfor *))
\end{header} \end{header}

View File

@ -3,7 +3,7 @@
\ignorespaces \ignorespaces
} }
\newsavebox\ANDbox \newsavebox\ANDbox
\sbox\ANDbox{$|$} \sbox\ANDbox{<<design.seperator_between_connections>>}
((* if not design.disable_last_updated_date *)) ((* if not design.disable_last_updated_date *))
\placelastupdatedtext \placelastupdatedtext
@ -16,16 +16,24 @@
\normalsize \normalsize
((* for connection in cv.connections *)) ((* for connection in cv.connections *))
((* if design.use_icons_for_connections *))
\mbox{((*- if connection["url"] -*))
\hrefWithoutArrow{<<connection["url"]>>}{{\footnotesize<<connection["latex_icon"]>>}\hspace*{0.13cm}<<connection["placeholder"]|escape_latex_characters>>}
((*- else -*))
{\footnotesize<<connection["latex_icon"]>>}\hspace*{0.13cm}<<connection["placeholder"]|escape_latex_characters>>
((*- endif -*))}%
((* else *))
\mbox{((*- if connection["url"] -*)) \mbox{((*- if connection["url"] -*))
\hrefWithoutArrow{<<connection["url"]>>}{<<connection["clean_url"]|escape_latex_characters>>} \hrefWithoutArrow{<<connection["url"]>>}{<<connection["clean_url"]|escape_latex_characters>>}
((*- else -*)) ((*- else -*))
<<connection["placeholder"]|escape_latex_characters>> <<connection["placeholder"]|escape_latex_characters>>
((*- endif -*))}% ((*- endif -*))}%
\kern <<design.margins.header.horizontal_between_connections|divide_length_by(2)>>%
((* if not loop.last *))
\AND%
((* endif *)) ((* endif *))
((* if not loop.last *))
\kern <<design.margins.header.horizontal_between_connections|divide_length_by(2)>>% \kern <<design.margins.header.horizontal_between_connections|divide_length_by(2)>>%
\AND%
\kern <<design.margins.header.horizontal_between_connections|divide_length_by(2)>>%
((* endif *))
((* endfor *)) ((* endfor *))
\end{header} \end{header}

View File

@ -162,6 +162,22 @@ class EngineeringresumesThemeOptions(ThemeOptions):
title="Text Alignment", title="Text Alignment",
description="The alignment of the text. The default value is left-aligned.", 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( margins: MarginsForEngineeringresumes = pydantic.Field(
default=MarginsForEngineeringresumes(), default=MarginsForEngineeringresumes(),
title="Margins", title="Margins",

View File

@ -62,7 +62,7 @@
((* if cv.social_networks *)) ((* if cv.social_networks *))
((* for network in cv.social_networks *)) ((* for network in cv.social_networks *))
\social[<<network.network|lower()>>]{<<network.username>>} \social[<<network.network|lower()|replace(" ", "")>>]{<<network.username>>}
((* endfor *)) ((* endfor *))
((* endif *)) ((* endif *))
% Social icons % Social icons

View File

@ -1,3 +1,10 @@
\newcommand{\AND}{\unskip
\cleaders\copy\ANDbox\hskip\wd\ANDbox
\ignorespaces
}
\newsavebox\ANDbox
\sbox\ANDbox{<<design.seperator_between_connections>>}
((* if not design.disable_last_updated_date *)) ((* if not design.disable_last_updated_date *))
\placelastupdatedtext \placelastupdatedtext
((* endif *)) ((* endif *))
@ -9,12 +16,24 @@
\normalsize \normalsize
((* for connection in cv.connections *)) ((* for connection in cv.connections *))
((* if design.use_icons_for_connections *))
\mbox{((*- if connection["url"] -*)) \mbox{((*- if connection["url"] -*))
\hrefWithoutArrow{<<connection["url"]>>}{\color{black}{\footnotesize<<connection["latex_icon"]>>}\hspace*{0.13cm}<<connection["placeholder"]|escape_latex_characters>>} \hrefWithoutArrow{<<connection["url"]>>}{\color{black}{\footnotesize<<connection["latex_icon"]>>}\hspace*{0.13cm}<<connection["placeholder"]|escape_latex_characters>>}
((*- else -*)) ((*- else -*))
{\color{black}{\footnotesize<<connection["latex_icon"]>>}\hspace*{0.13cm}<<connection["placeholder"]|escape_latex_characters>>} {\color{black}\footnotesize<<connection["latex_icon"]>>}\hspace*{0.13cm}<<connection["placeholder"]|escape_latex_characters>>
((*- endif -*))} ((*- endif -*))}%
\kern <<design.margins.header.horizontal_between_connections>> ((* else *))
\mbox{((*- if connection["url"] -*))
\hrefWithoutArrow{<<connection["url"]>>}{<<connection["clean_url"]|escape_latex_characters>>}
((*- else -*))
<<connection["placeholder"]|escape_latex_characters>>
((*- endif -*))}%
((* endif *))
((* if not loop.last *))
\kern <<design.margins.header.horizontal_between_connections|divide_length_by(2)>>%
\AND%
\kern <<design.margins.header.horizontal_between_connections|divide_length_by(2)>>%
((* endif *))
((* endfor *)) ((* endfor *))
\end{header} \end{header}