mirror of
https://github.com/moderncv/moderncv.git
synced 2026-02-06 10:05:19 +01:00
Added hyperlinks to phone numbers
This commit is contained in:
parent
5b173abf55
commit
ff9f58b350
1 changed files with 22 additions and 1 deletions
23
moderncv.cls
23
moderncv.cls
|
|
@ -191,6 +191,7 @@
|
||||||
% compatibility package with older versions of moderncv
|
% compatibility package with older versions of moderncv
|
||||||
\RequirePackageWithOptions{moderncvcompatibility}
|
\RequirePackageWithOptions{moderncvcompatibility}
|
||||||
|
|
||||||
|
\RequirePackage{l3regex}
|
||||||
|
|
||||||
%-------------------------------------------------------------------------------
|
%-------------------------------------------------------------------------------
|
||||||
% class definition
|
% class definition
|
||||||
|
|
@ -247,7 +248,11 @@
|
||||||
% usage: \phone[<optional type>]{<number>}
|
% usage: \phone[<optional type>]{<number>}
|
||||||
% where <optional type> should be either "fixed" (default), "mobile" or "fax
|
% where <optional type> should be either "fixed" (default), "mobile" or "fax
|
||||||
\collectionnew{phones}
|
\collectionnew{phones}
|
||||||
\newcommand*{\phone}[2][fixed]{\collectionadd[#1]{phones}{#2}}
|
\NewDocumentCommand{\phone}{O{fixed}m}{%
|
||||||
|
\ifthenelse{\equal{#1}{fax}}%
|
||||||
|
{\collectionadd[#1]{phones}{#2}}
|
||||||
|
{\collectionadd[#1]{phones}{\protect\tellink{#2}}}
|
||||||
|
}
|
||||||
|
|
||||||
% adds a social link to one's personal information (optional)
|
% adds a social link to one's personal information (optional)
|
||||||
% usage: \social[<optional type>][<optional url>]{<account name>}
|
% usage: \social[<optional type>][<optional url>]{<account name>}
|
||||||
|
|
@ -501,6 +506,22 @@
|
||||||
\ifthenelse{\equal{#1}{}}%
|
\ifthenelse{\equal{#1}{}}%
|
||||||
{\href{mailto:#2}{#2}}%
|
{\href{mailto:#2}{#2}}%
|
||||||
{\href{mailto:#2}{#1}}}
|
{\href{mailto:#2}{#1}}}
|
||||||
|
|
||||||
|
% makes a tel hyperlink
|
||||||
|
% usage: \tellink[optional text]{link}
|
||||||
|
\newcommand*{\tellink}[2][]{%
|
||||||
|
\ifthenelse{\equal{#1}{}}%
|
||||||
|
{\expandafter\onlynumberslink\expandafter{#2}{#2}}%
|
||||||
|
{\expandafter\onlynumberslink\expandafter{#2}{#1}}}
|
||||||
|
|
||||||
|
\ExplSyntaxOn
|
||||||
|
\tl_new:N \l_onlynumberslink_tl
|
||||||
|
\cs_new:Npn \onlynumberslink #1 #2 {
|
||||||
|
\tl_set:Nn \l_onlynumberslink_tl {#1}
|
||||||
|
\regex_replace_all:nnN {[^0-9+]} {} \l_onlynumberslink_tl
|
||||||
|
\href{ tel\token_to_str:N : \tl_use:N \l_onlynumberslink_tl}{ #2 }
|
||||||
|
}
|
||||||
|
\ExplSyntaxOff
|
||||||
|
|
||||||
% cvcolumns environment, where every column is created through \cvcolumn
|
% cvcolumns environment, where every column is created through \cvcolumn
|
||||||
% usage: \begin{cvcolumns}
|
% usage: \begin{cvcolumns}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue