Contact details can be empty strings, skip those

This commit is contained in:
Óscar Nájera 2019-02-02 17:47:47 +01:00
parent 19213346a8
commit 3900071b8d
3 changed files with 36 additions and 25 deletions

View file

@ -139,19 +139,23 @@ holding export options."
"\\personalinfo{\n"
;; address
(let ((address (org-export-data (plist-get info :address) info)))
(when (org-string-nw-p address) (format "\\mailaddress{%s}\n"
(mapconcat (lambda (line) (format "%s" line))
(split-string address "\n") " -- "))))
(when (org-string-nw-p address)
(format "\\mailaddress{%s}\n" (mapconcat (lambda (line)
(format "%s" line))
(split-string address "\n") " -- "))))
;; email
(let ((email (and (plist-get info :with-email)
(org-export-data (plist-get info :email) info))))
(when email (format "\\email{%s}\n" email)))
(when (org-string-nw-p email)
(format "\\email{%s}\n" email)))
;; phone
(let ((mobile (org-export-data (plist-get info :mobile) info)))
(when mobile (format "\\phone{%s}\n" mobile)))
(when (org-string-nw-p mobile)
(format "\\phone{%s}\n" mobile)))
;; homepage
(let ((homepage (org-export-data (plist-get info :homepage) info)))
(when homepage (format "\\homepage{%s}\n" homepage)))
(when (org-string-nw-p homepage)
(format "\\homepage{%s}\n" homepage)))
(mapconcat (lambda (social-network)
(let ((command (org-export-data (plist-get info
(car social-network))

View file

@ -118,23 +118,25 @@ holding export options."
;; email
(let ((email (and (plist-get info :with-email)
(org-export-data (plist-get info :email) info))))
(when email (format "<li class=\"fa fa-envelope\"><a href=\"mailto:%s\"> %s</a></li>\n" email email)))
(when (org-string-nw-p email)
(format "<li class=\"fa fa-envelope\"><a href=\"mailto:%s\"> %s</a></li>\n" email email)))
;; homepage
(let ((homepage (org-export-data (plist-get info :homepage) info)))
(when homepage (format "<li class=\"fa fa-globe\"><a href=\"https://%s\"> %s</a></li>\n" homepage homepage)))
(when (org-string-nw-p homepage) (format "<li class=\"fa fa-globe\"><a href=\"https://%s\"> %s</a></li>\n" homepage homepage)))
;; social media
(mapconcat (lambda (social-network)
(let ((command (org-export-data (plist-get info
(car social-network))
(let ((network (org-export-data
(plist-get info (car social-network))
info)))
(and command (format "<li class=\"fa fa-%s\"><a href=\"https://%s/%s\"> %s</a></li>\n"
(when (org-string-nw-p network)
(format "<li class=\"fa fa-%s\"><a href=\"https://%s/%s\"> %s</a></li>\n"
(nth 1 social-network)
(nth 2 social-network)
command
command))))
network
network))))
'((:github "github" "www.github.com")
(:gitlab "gitlab" "www.gitlab.com")

View file

@ -104,28 +104,33 @@ holding export options."
(format "\\name{%s}{}\n" author))
;; photo
(let ((photo (org-export-data (plist-get info :photo) info)))
(when (org-string-nw-p photo) (format "\\photo{%s}\n" photo)))
(when (org-string-nw-p photo)
(format "\\photo{%s}\n" photo)))
;; email
(let ((email (and (plist-get info :with-email)
(org-export-data (plist-get info :email) info))))
(when email (format "\\email{%s}\n" email)))
(when (org-string-nw-p email)
(format "\\email{%s}\n" email)))
;; phone
(let ((mobile (org-export-data (plist-get info :mobile) info)))
(when mobile (format "\\phone[mobile]{%s}\n" mobile)))
(when (org-string-nw-p mobile)
(format "\\phone[mobile]{%s}\n" mobile)))
;; homepage
(let ((homepage (org-export-data (plist-get info :homepage) info)))
(when homepage (format "\\homepage{%s}\n" homepage)))
(when (org-string-nw-p homepage)
(format "\\homepage{%s}\n" homepage)))
;; address
(let ((address (org-export-data (plist-get info :address) info)))
(when address (format "\\address%s\n" (mapconcat (lambda (line) (format "{%s}" line))
(split-string address "\n") ""))))
(when (org-string-nw-p address)
(format "\\address%s\n" (mapconcat (lambda (line)
(format "{%s}" line))
(split-string address "\n") ""))))
(mapconcat (lambda (social-network)
(let ((command (org-export-data (plist-get info
(car social-network))
info)))
(and command (format "\\social[%s]{%s}\n"
(nth 1 social-network)
command))))
(let ((network (org-export-data
(plist-get info (car social-network)) info)))
(when (org-string-nw-p network)
(format "\\social[%s]{%s}\n"
(nth 1 social-network) network))))
'((:github "github")
(:gitlab "gitlab")
(:linkedin "linkedin"))