diff --git a/org-cv-utils.el b/org-cv-utils.el index f1d4cca..7edc942 100644 --- a/org-cv-utils.el +++ b/org-cv-utils.el @@ -55,7 +55,7 @@ If both dates are the same, return just FROM-DATE" (org-cv-utils-org-timestamp-to-shortdate to-date)))) (if from - (if (or (string= from to) (string-equal-ignore-case to "skip")) + (if (or (string= from to)) from (concat from " -- " to)) ""))) @@ -63,13 +63,23 @@ If both dates are the same, return just FROM-DATE" (defun org-cv-utils--parse-cventry (headline info) "Return alist describing the entry in HEADLINE. INFO is a plist used as a communication channel." - (let ((title (org-export-data (org-element-property :title headline) info))) + (let* ((title (org-export-data (org-element-property :title headline) info)) + (date (org-element-property :DATE headline)) + (from-date (or (org-element-property :FROM headline) date)) + (to-date (or (org-element-property :TO headline) date)) + (host (or (org-element-property :HOST headline) + (org-element-property :ORGANIZATION headline) + (org-element-property :INSTITUTION headline) + (org-element-property :SCHOOL headline) + (org-element-property :EMPLOYER headline) + (org-element-property :EVENT headline) ""))) `((title . ,title) - (from-date . ,(or (org-element-property :FROM headline) + (from-date . ,(or from-date (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) ""))))) + (to-date . ,to-date) + (host . ,host) + (location . ,(or (org-element-property :LOCATION headline) "")) + (image . ,(org-element-property :IMAGE headline))))) (provide 'org-cv-utils) ;;; org-cv-utils.el ends here diff --git a/ox-hugocv.el b/ox-hugocv.el index f55a9e7..ad31d12 100644 --- a/ox-hugocv.el +++ b/ox-hugocv.el @@ -57,8 +57,8 @@ (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) + (host + (-some->> (alist-get 'host entry) (format "%s\n{.cv-host}"))) (date (-some->> @@ -73,14 +73,19 @@ "Format HEADLINE as as cventry. CONTENTS holds the contents of the headline. INFO is a plist used as a communication channel." - (let* ((entry (org-cv-utils--parse-cventry headline info)) + (let* ((environment (org-export-get-tags headline info)) + (env-class (string-replace "cv" "" (cl-find-if (lambda (s) (string-prefix-p "cv" s)) environment))) + (entry (org-cv-utils--parse-cventry headline info)) (loffset (string-to-number (plist-get info :hugo-level-offset))) ;"" -> 0, "0" -> 0, "1" -> 1, .. (level (org-export-get-relative-level headline info)) - (title (concat (make-string (+ loffset level) ?#) " " (alist-get 'title entry)))) - (format "
\n\n%s\n\n%s\n\n%s\n
" - (concat title " {.cv-role}") + (title (concat (make-string (+ loffset level) ?#) " " + (alist-get 'title entry) + " {.cv-role}"))) + (format "
\n\n%s\n\n%s\n\n%s\n
" + env-class + title (mapconcat (lambda (field) (org-hugocv--entry-with-icon field entry)) - '(employer date location) + '(host date location) "\n") contents))) @@ -92,7 +97,7 @@ as a communication channel." (unless (org-element-property :footnote-section-p headline) (let ((environment (org-export-get-tags headline info))) (cond - ((seq-intersection environment '("cventry")) + ((cl-find-if (lambda (s) (string-prefix-p "cv" s)) environment) (org-hugocv--format-cventry headline contents info)) ((org-export-with-backend 'hugo headline contents info))))))