forked from mirrors/org-cv
hugo export skipping empty entries
This commit is contained in:
parent
210d9c2720
commit
5109cbf0c8
2 changed files with 23 additions and 11 deletions
|
@ -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) "")))))
|
||||
|
|
28
ox-hugocv.el
28
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 "<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)
|
||||
"Format HEADLINE as as cventry.
|
||||
|
@ -66,17 +81,14 @@ as a communication channel."
|
|||
(format "<div class=\"cv-entry\">
|
||||
\n%s
|
||||
|
||||
<i class=\"fa fa-building\"></i>%s<br/>
|
||||
<i class=\"fa fa-calendar\"></i>%s
|
||||
<i class=\"fa fa-map-marker\"></i>%s
|
||||
%s
|
||||
|
||||
%s
|
||||
|
||||
</div>
|
||||
" 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)
|
||||
</div>" title
|
||||
(mapconcat (lambda (field) (org-hugocv--entry-with-icon field entry))
|
||||
'(employer date location)
|
||||
"\n")
|
||||
contents)))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue