mirror of
https://gitlab.com/Titan-C/org-cv.git
synced 2024-11-21 13:38:35 +00:00
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)
|
(require 'org-element)
|
||||||
|
|
||||||
(defun org-cv-utils-org-timestamp-to-shortdate (date_str)
|
(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
|
Other strings are just returned unmodified
|
||||||
|
|
||||||
e.g. <2012-08-12 Mon> => Aug 2012
|
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))))
|
(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))
|
||||||
"")))
|
"")))
|
||||||
|
@ -65,7 +65,7 @@ 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)))
|
||||||
`((title . ,title)
|
`((title . ,title)
|
||||||
(from-date . ,(or (org-element-property :FROM headline)
|
(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))
|
(to-date . ,(org-element-property :TO headline))
|
||||||
(employer . ,(org-element-property :EMPLOYER headline))
|
(employer . ,(org-element-property :EMPLOYER headline))
|
||||||
(location . ,(or (org-element-property :LOCATION headline) "")))))
|
(location . ,(or (org-element-property :LOCATION headline) "")))))
|
||||||
|
|
28
ox-hugocv.el
28
ox-hugocv.el
|
@ -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)))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue