hugo export skipping empty entries

This commit is contained in:
Oscar Najera 2023-10-19 19:23:34 +02:00
parent 210d9c2720
commit 5109cbf0c8
2 changed files with 23 additions and 11 deletions

View file

@ -54,7 +54,7 @@ If both dates are the same, return just FROM-DATE"
(org-cv-utils-org-timestamp-to-shortdate to-date)))) (org-cv-utils-org-timestamp-to-shortdate to-date))))
(if from (if from
(if (string= from to) (if (or (string= from to) (string-equal-ignore-case to "skip"))
from from
(concat from " -- " to)) (concat from " -- " to))
""))) "")))

View file

@ -29,6 +29,7 @@
;;; Code: ;;; Code:
(require 'ox-hugo) (require 'ox-hugo)
(require 'dash)
(require 'org-cv-utils) (require 'org-cv-utils)
;;; User-Configurable Variables ;;; User-Configurable Variables
@ -54,6 +55,20 @@
) )
:translate-alist '((headline . org-hugocv-headline))) :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 "<i class=\"fa fa-building\"></i>%s<br/>")))
(date
(-some->>
(org-cv-utils--format-time-window (alist-get 'from-date entry) (alist-get 'to-date entry))
(format "<i class=\"fa fa-calendar\"></i>%s")))
(location
(-some->> (alist-get 'location entry)
(org-string-nw-p)
(format "<i class=\"fa fa-map-marker\"></i>%s")))))
(defun org-hugocv--format-cventry (headline contents info) (defun org-hugocv--format-cventry (headline contents info)
"Format HEADLINE as as cventry. "Format HEADLINE as as cventry.
@ -66,17 +81,14 @@ as a communication channel."
(format "<div class=\"cv-entry\"> (format "<div class=\"cv-entry\">
\n%s \n%s
<i class=\"fa fa-building\"></i>%s<br/> %s
<i class=\"fa fa-calendar\"></i>%s
<i class=\"fa fa-map-marker\"></i>%s
%s %s
</div> </div>" title
" title (mapconcat (lambda (field) (org-hugocv--entry-with-icon field entry))
(alist-get 'employer entry) '(employer date location)
(org-cv-utils--format-time-window (alist-get 'from-date entry) (alist-get 'to-date entry)) "\n")
(alist-get 'location entry)
contents))) contents)))