diff --git a/rendercv/data_model.py b/rendercv/data_model.py index 7a31c24..1f20440 100644 --- a/rendercv/data_model.py +++ b/rendercv/data_model.py @@ -81,7 +81,7 @@ def check_spelling(sentence: str) -> str: r"\-+", " ", modifiedSentence ) # replace hyphens with spaces modifiedSentence = re.sub( - "[^a-z\s\-']", "", modifiedSentence + r"[^a-z\s\-']", "", modifiedSentence ) # remove all the special characters words = modifiedSentence.split() # split sentence into a list of words misspelled = spell.unknown(words) # find misspelled words @@ -777,14 +777,14 @@ class SocialNetwork(BaseModel): class Connection(BaseModel): - """This class stores a connection/communication information. + r"""This class stores a connection/communication information. Warning: This class isn't designed for users to use, but it is used by RenderCV to make the $\LaTeX$ templating easier. """ - name: Literal["LinkedIn", "GitHub", "Instagram", "phone", "email", "website"] + name: Literal["LinkedIn", "GitHub", "Instagram", "phone", "email", "website", "location"] value: str @computed_field @@ -802,6 +802,8 @@ class Connection(BaseModel): url = f"{self.value}" elif self.name == "phone": url = f"{self.value}" + elif self.name == "location": + url = None else: raise RuntimeError(f'"{self.name}" is not a valid connection!"') @@ -945,6 +947,8 @@ class CurriculumVitae(BaseModel): @cached_property def connections(self) -> list[str]: connections = [] + if self.location is not None: + connections.append(Connection(name="location", value=self.location)) if self.phone is not None: connections.append(Connection(name="phone", value=self.phone)) if self.email is not None: @@ -1015,8 +1019,9 @@ class CurriculumVitae(BaseModel): # Find the corresponding custom section and get its entries: if self.custom_sections is None: raise ValueError( - f'"{section_name}" is not a valid section name. Please fix the' - " section_order field." + f'"{section_name}" is not a valid section name. Please create a' + " custom section with this name or delete it from the section" + " order." ) else: for custom_section in self.custom_sections: diff --git a/rendercv/templates/components/classic/header_connections.tex.j2 b/rendercv/templates/components/classic/header_connections.tex.j2 index e95b471..eb1dc0c 100644 --- a/rendercv/templates/components/classic/header_connections.tex.j2 +++ b/rendercv/templates/components/classic/header_connections.tex.j2 @@ -1,8 +1,28 @@ ((# Each macro in here is a link with an icon for header. #)) -((* macro LinkedIn(username, url) *))\href{<>}{{\small\faLinkedinIn}\hspace{0.13cm}<>}((* endmacro *)) -((* macro GitHub(username, url) *))\href{<>}{{\small\faGithub}\hspace{0.13cm}<>}((* endmacro *)) -((* macro Instagram(username, url) *))\href{}{{\small\faInstagram}\hspace{0.13cm}<>}((* endmacro *)) -((* macro phone(number, url) *))\href{<>}{{\footnotesize\faPhone*}\hspace{0.13cm}<>}((* endmacro *)) -((* macro email(email, url) *))\href{<>}{{\small\faEnvelope[regular]}\hspace{0.13cm}<>}((* endmacro *)) -((* macro website(url, dummy) *))\href{<>}{{\small\faLink}\hspace{0.13cm}<>}((* endmacro *)) +((* macro LinkedIn(username, url) -*)) +\mbox{\href{<>}{{\small\faLinkedinIn}\hspace{0.13cm}<>}} +((*- endmacro *)) +((* macro GitHub(username, url) -*)) +\mbox{\href{<>}{{\small\faGithub}\hspace{0.13cm}<>}} +((*- endmacro *)) + +((* macro Instagram(username, url) -*)) +\mbox{\href{}{{\small\faInstagram}\hspace{0.13cm}<>}} +((*- endmacro *)) + +((* macro phone(number, url) -*)) +\mbox{{\footnotesize\faPhone*}\hspace{0.13cm}<>} +((*- endmacro *)) + +((* macro email(email, url) -*)) +\mbox{\href{<>}{{\small\faEnvelope[regular]}\hspace{0.13cm}<>}} +((*- endmacro *)) + +((* macro website(url, dummy) -*)) +\mbox{\href{<>}{{\small\faLink}\hspace{0.13cm}<>}} +((*- endmacro *)) + +((* macro location(location, url) -*)) +\mbox{{\small\faMapMarker*}\hspace{0.13cm}<>} +((*- endmacro *))