From 85c6b06d644622fbaca523ee19d5990b4d8d9ac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20W=C3=BCrfl?= Date: Sun, 23 Apr 2017 15:44:06 +0200 Subject: [PATCH] Allow https:// for urls in \homepage Up to now, the template always inserted a 'http://' in the url for the \homepage{} attribute. Therefore, it was not possible to specify 'https://example.com' as this would have resulted in 'http://https://example.com'. The new approach allows to specify the homepage-url in any of the following ways (which will result in the specified strings) | url provided to \homepage | hyperlink | displayed url-text | |---------------------------|-----------|--------------------| | http://example.com | http://example.com | example.com | | https://example.com | https://example.com | example.com | | example.com | http://example.com | example.com | Note that the third row is equivalent to the current behavior. --- awesome-cv.cls | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/awesome-cv.cls b/awesome-cv.cls index d1c1074..79fecb5 100644 --- a/awesome-cv.cls +++ b/awesome-cv.cls @@ -88,6 +88,8 @@ pdfsubject={}, pdfkeywords={} } +% Needed for string comparison & manipulation (e.g. in \homepage) +\RequirePackage{xstring} %------------------------------------------------------------------------------- @@ -452,7 +454,26 @@ {}% {% \ifbool{isstart}{\setbool{isstart}{false}}{\acvHeaderSocialSep}% - \href{http://\@homepage}{\faHome\acvHeaderIconSep\@homepage}% + \IfBeginWith{\@homepage}{http://}{% + % \@homepage begins with 'http://'% + \def\awesomecvHomepageUrl{\@homepage}% + % strip http:// from displayed text % + \def\aewsomecvHomepageText{\StrBehind{\@homepage}{http://}}% + }{% + % \@homepage does not begin with 'http://'% + \IfBeginWith{\@homepage}{https://}{% + % \@homepage begins with 'https://'% + \def\awesomecvHomepageUrl{\@homepage}% + % strip https:// from displayed text % + \def\aewsomecvHomepageText{\StrBehind{\@homepage}{https://}}% + }{% + % \@homepage begins with neither 'http://' nor 'https://'% + % -> force http scheme% + \def\awesomecvHomepageUrl{http://\@homepage}% + \def\aewsomecvHomepageText{\@homepage}% + }% + }% + \href{\awesomecvHomepageUrl}{\faHome\acvHeaderIconSep\aewsomecvHomepageText}% }% \ifthenelse{\isundefined{\@github}}% {}%