diff --git a/org-cv-utils.el b/org-cv-utils.el index a4b01fd..3f405bb 100644 --- a/org-cv-utils.el +++ b/org-cv-utils.el @@ -31,7 +31,7 @@ (require 'org-element) (defun org-cv-utils-org-timestamp-to-shortdate (date_str) -"Format orgmode timestamp DATE_STR into a short form date. + "Format orgmode timestamp DATE_STR into a short form date. Other strings are just returned unmodified e.g. <2012-08-12 Mon> => Aug 2012 @@ -54,7 +54,7 @@ If both dates are the same, return just FROM-DATE" (org-cv-utils-org-timestamp-to-shortdate to-date)))) (if from - (if (string= from to) + (if (or (string= from to) (string-equal-ignore-case to "skip")) from (concat from " -- " to)) ""))) @@ -65,7 +65,7 @@ INFO is a plist used as a communication channel." (let ((title (org-export-data (org-element-property :title headline) info))) `((title . ,title) (from-date . ,(or (org-element-property :FROM headline) - (error "No FROM property provided for cventry %s" title))) + (error "No FROM property provided for cventry %s" title))) (to-date . ,(org-element-property :TO headline)) (employer . ,(org-element-property :EMPLOYER headline)) (location . ,(or (org-element-property :LOCATION headline) ""))))) diff --git a/ox-hugocv.el b/ox-hugocv.el index 59a7c38..325c8c4 100644 --- a/ox-hugocv.el +++ b/ox-hugocv.el @@ -29,6 +29,7 @@ ;;; Code: (require 'ox-hugo) +(require 'dash) (require 'org-cv-utils) ;;; User-Configurable Variables @@ -54,6 +55,20 @@ ) :translate-alist '((headline . org-hugocv-headline))) +(defun org-hugocv--entry-with-icon (field entry) + "HTML entry for given FIELD when it is specified in ENTRY." + (cl-ecase field + (employer + (-some->> (alist-get 'employer entry) + (format "%s
"))) + (date + (-some->> + (org-cv-utils--format-time-window (alist-get 'from-date entry) (alist-get 'to-date entry)) + (format "%s"))) + (location + (-some->> (alist-get 'location entry) + (org-string-nw-p) + (format "%s"))))) (defun org-hugocv--format-cventry (headline contents info) "Format HEADLINE as as cventry. @@ -66,17 +81,14 @@ as a communication channel." (format "
\n%s -%s
-%s -%s +%s %s -
-" title -(alist-get 'employer entry) -(org-cv-utils--format-time-window (alist-get 'from-date entry) (alist-get 'to-date entry)) -(alist-get 'location entry) +" title +(mapconcat (lambda (field) (org-hugocv--entry-with-icon field entry)) + '(employer date location) + "\n") contents)))