1
0
Fork 0

refactor contact

This commit is contained in:
Óscar Nájera 2020-06-01 21:16:28 +02:00
parent edfe13f3af
commit 5e34c09388
1 changed files with 17 additions and 11 deletions

View File

@ -52,20 +52,25 @@
:translate-alist '((headline . org-hugocv-headline)
(inner-template . org-hugocv-inner-template)))
(defvar recognized-social-networks
'((:url "https://www.github.com"
(setq org-hugocv--recognized-social-networks
'((:url "https://www.github.com/"
:icon "fa-github")
(:url "https://www.gitlab.com"
(:url "https://www.gitlab.com/"
:icon "fa-gitlab")
(:url "https://www.linkedin.com/in"
(:url "https://www.linkedin.com/in/"
:icon "fa-linkedin")
(:url "https://twitter.com"
(:url "https://twitter.com/"
:icon "fa-twitter")
(:url "https://facebook.com"
(:url "https://facebook.com/"
:icon "fa-facebook")
(:url "https://www.instagram.com"
(:url "https://www.instagram.com/"
:icon "fa-instagram")))
(defun org-hugocv--crop-edges (x)
"String is <X> so remove first and last chars."
(let ((le (- (length x) 1)))
(substring x 1 le)))
(defun org-hugocv--format-cventry (headline contents info)
"Format HEADLINE as as cventry.
CONTENTS holds the contents of the headline. INFO is a plist used
@ -94,7 +99,7 @@ contents)))
(let* ((nw-handle (string-trim handle))
(icon-wrap (if (org-string-nw-p icon)
(format "<i class=\"fa %s\"> %s</i>" icon nw-handle) nw-handle)))
(format "<a href=\"%s/%s\">%s</a>" url nw-handle icon-wrap)))
(format "<a href=\"%s%s\">%s</a>" url nw-handle icon-wrap)))
(defun org-hugocv--unknown-social-channels (headline contents info)
(let ((icon (org-export-data (org-element-property :ICON headline) info))
@ -146,10 +151,11 @@ holding export options."
(let ((email (and (plist-get info :with-email)
(org-export-data (plist-get info :email) info))))
(when (org-string-nw-p email)
(format "<li class=\"fa fa-envelope\"><a href=\"mailto:%s\"> %s</a></li>\n" email email)))
(social-entry "fa-envelope" "mailto:" email)))
;; homepage
(let ((homepage (org-export-data (plist-get info :homepage) info)))
(when (org-string-nw-p homepage) (format "<li class=\"fa fa-globe\"><a href=\"https://%s\"> %s</a></li>\n" homepage homepage)))
(let ((homepage (org-hugocv--crop-edges (org-export-data (plist-get info :homepage) info))))
(when (org-string-nw-p homepage)
(social-entry "fa-globe" "" homepage)))
"</ul>\n\n"
(org-hugo-inner-template contents info)))