diff --git a/examples/template.tex b/examples/template.tex index 9d3cab45..292e868c 100644 --- a/examples/template.tex +++ b/examples/template.tex @@ -33,7 +33,7 @@ \email{john@doe.org} % optional, remove / comment the line if not wanted \homepage{www.johndoe.com} % optional, remove / comment the line if not wanted \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[xing]{john_doe} % optional, remove / comment the line if not wanted \social[twitter]{jdoe} % 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 diff --git a/moderncv.cls b/moderncv.cls index 3511c2cd..1fab25ab 100644 --- a/moderncv.cls +++ b/moderncv.cls @@ -191,7 +191,7 @@ % compatibility package with older versions of moderncv \RequirePackageWithOptions{moderncvcompatibility} -\RequirePackage{l3regex} +%\RequirePackage{l3regex} %------------------------------------------------------------------------------- % class definition @@ -262,12 +262,12 @@ \NewDocumentCommand{\social}{O{}O{}m}{% \ifthenelse{\equal{#2}{}}% {% - \ifthenelse{\equal{#1}{linkedin}}{\collectionadd[linkedin]{socials}{\protect\httplink[#3]{www.linkedin.com/in/#3}}} {}% - \ifthenelse{\equal{#1}{xing}} {\collectionadd[xing]{socials} {\protect\httplink[#3]{www.xing.com/profile/#3}}}{}% - \ifthenelse{\equal{#1}{twitter}} {\collectionadd[twitter]{socials} {\protect\httplink[#3]{www.twitter.com/#3}}} {}% - \ifthenelse{\equal{#1}{github}} {\collectionadd[github]{socials} {\protect\httplink[#3]{www.github.com/#3}}} {}% - \ifthenelse{\equal{#1}{gitlab}} {\collectionadd[gitlab]{socials} {\protect\httplink[#3]{www.gitlab.com/#3}}} {}% - \ifthenelse{\equal{#1}{skype}} {\collectionadd[skype]{socials} {#3}} {}% + \ifthenelse{\equal{#1}{linkedin}}{\collectionadd[linkedin]{socials}{\protect\httpslink[#3]{www.linkedin.com/in/#3}}} {}% + \ifthenelse{\equal{#1}{xing}} {\collectionadd[xing]{socials} {\protect\httpslink[#3]{www.xing.com/profile/#3}}}{}% + \ifthenelse{\equal{#1}{twitter}} {\collectionadd[twitter]{socials} {\protect\httpslink[#3]{www.twitter.com/#3}}} {}% + \ifthenelse{\equal{#1}{github}} {\collectionadd[github]{socials} {\protect\httpslink[#3]{www.github.com/#3}}} {}% + \ifthenelse{\equal{#1}{gitlab}} {\collectionadd[gitlab]{socials} {\protect\httpslink[#3]{www.gitlab.com/#3}}} {}% + \ifthenelse{\equal{#1}{skype}} {\collectionadd[skype]{socials} {#3}} {}% } {\collectionadd[#1]{socials}{\protect\httplink[#3]{#2}}}} @@ -507,6 +507,23 @@ {\href{http://#2}{#2}}% {\href{http://#2}{#1}}} +% makes a https hyperlink with escaped underscore in link name +% usage: \httpslink[optional text]{link} +\newcommand*{\httpslink}[2][]{% + \ifthenelse{\equal{#1}{}}% + {\href{https://#2}{\expandafter\escapeunderscore\expandafter{#2}}} + {\href{https://#2}{\expandafter\escapeunderscore\expandafter{#1}}} +} + +\ExplSyntaxOn +\tl_new:N \l_escapeunderscore_tl +\cs_new:Npn \escapeunderscore #1 { + \tl_set:Nn \l_escapeunderscore_tl {#1} + \regex_replace_all:nnN {\_} {_} \l_escapeunderscore_tl + \tl_use:N \l_escapeunderscore_tl +} +\ExplSyntaxOff + % makes an email hyperlink % usage: \emaillink[optional text]{link} \newcommand*{\emaillink}[2][]{%