From e934bcf91d88f116f19f14a934a6ea9f5119ba95 Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Sat, 21 Oct 2023 14:58:55 +0200 Subject: [PATCH] hugo export using only class styles for properties employer, date, location are now classes not html5 i tags with set font-awesome --- org-cv-utils.el | 1 + ox-hugocv.el | 39 ++++++++++++++------------------------- 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/org-cv-utils.el b/org-cv-utils.el index 3f405bb..f1d4cca 100644 --- a/org-cv-utils.el +++ b/org-cv-utils.el @@ -28,6 +28,7 @@ ;;; Code: (require 'org) +(require 'ox) (require 'org-element) (defun org-cv-utils-org-timestamp-to-shortdate (date_str) diff --git a/ox-hugocv.el b/ox-hugocv.el index 325c8c4..f55a9e7 100644 --- a/ox-hugocv.el +++ b/ox-hugocv.el @@ -35,7 +35,7 @@ ;;; User-Configurable Variables (defgroup org-export-hugocv nil - "Options for exporting Org mode files to Hugo-compatible Markdown" + "Options for exporting Org mode files to Hugo-compatible Markdown." :tag "Org Export Hugo CV" :group 'org-export :version "25.3") @@ -43,8 +43,7 @@ ;;; Define Back-End (org-export-define-derived-backend 'hugocv 'hugo :options-alist - '( - (:mobile "MOBILE" nil nil parse) + '((:mobile "MOBILE" nil nil parse) (:homepage "HOMEPAGE" nil nil parse) (:address "ADDRESS" nil nil newline) (:photo "PHOTO" nil nil parse) @@ -60,15 +59,15 @@ (cl-ecase field (employer (-some->> (alist-get 'employer entry) - (format "%s
"))) + (format "%s\n{.cv-host}"))) (date (-some->> (org-cv-utils--format-time-window (alist-get 'from-date entry) (alist-get 'to-date entry)) - (format "%s"))) + (format "%s\n{.cv-date}"))) (location (-some->> (alist-get 'location entry) (org-string-nw-p) - (format "%s"))))) + (format "%s\n{.cv-location}"))))) (defun org-hugocv--format-cventry (headline contents info) "Format HEADLINE as as cventry. @@ -78,20 +77,12 @@ as a communication channel." (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%s - -%s - -%s - -
" title -(mapconcat (lambda (field) (org-hugocv--entry-with-icon field entry)) - '(employer date location) - "\n") -contents))) - - + (format "
\n\n%s\n\n%s\n\n%s\n
" + (concat title " {.cv-role}") + (mapconcat (lambda (field) (org-hugocv--entry-with-icon field entry)) + '(employer date location) + "\n") + contents))) ;;;; Headline (defun org-hugocv-headline (headline contents info) @@ -99,13 +90,11 @@ contents))) CONTENTS is the contents of the headline. INFO is a plist used as a communication channel." (unless (org-element-property :footnote-section-p headline) - (let ((environment (let ((env (org-element-property :CV_ENV headline))) - (or (org-string-nw-p env) "block")))) + (let ((environment (org-export-get-tags headline info))) (cond - ;; is a cv entry - ((equal environment "cventry") + ((seq-intersection environment '("cventry")) (org-hugocv--format-cventry headline contents info)) ((org-export-with-backend 'hugo headline contents info)))))) (provide 'ox-hugocv) -;;; ox-hugocv ends here +;;; ox-hugocv.el ends here