From 3900071b8dd73816345bb07ea59e17c148e19afc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20N=C3=A1jera?= Date: Sat, 2 Feb 2019 17:47:47 +0100 Subject: [PATCH] Contact details can be empty strings, skip those --- ox-altacv.el | 16 ++++++++++------ ox-hugocv.el | 16 +++++++++------- ox-moderncv.el | 29 +++++++++++++++++------------ 3 files changed, 36 insertions(+), 25 deletions(-) diff --git a/ox-altacv.el b/ox-altacv.el index 689e01e..99d0680 100644 --- a/ox-altacv.el +++ b/ox-altacv.el @@ -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)) diff --git a/ox-hugocv.el b/ox-hugocv.el index 44b41c1..77b17ed 100644 --- a/ox-hugocv.el +++ b/ox-hugocv.el @@ -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 "
  • %s
  • \n" email email))) + (when (org-string-nw-p email) + (format "
  • %s
  • \n" email email))) ;; homepage (let ((homepage (org-export-data (plist-get info :homepage) info))) - (when homepage (format "
  • %s
  • \n" homepage homepage))) + (when (org-string-nw-p homepage) (format "
  • %s
  • \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 "
  • %s
  • \n" + (when (org-string-nw-p network) + (format "
  • %s
  • \n" (nth 1 social-network) (nth 2 social-network) - command - command)))) + network + network)))) '((:github "github" "www.github.com") (:gitlab "gitlab" "www.gitlab.com") diff --git a/ox-moderncv.el b/ox-moderncv.el index 564638f..8f5374e 100644 --- a/ox-moderncv.el +++ b/ox-moderncv.el @@ -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"))