From ca364bca8ace40f13008095aac2a244fa623761f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20N=C3=A1jera?= Date: Fri, 23 Mar 2018 23:00:17 +0100 Subject: [PATCH] handle dates --- ox-cv.el | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/ox-cv.el b/ox-cv.el index 35dd801..ad95d26 100644 --- a/ox-cv.el +++ b/ox-cv.el @@ -141,14 +141,29 @@ holding export options." ;; Document end. "\\end{document}"))) + +(defun org-cv-timestamp-to-shortdate (date_str) + "e.g. <2002-08-12 Mon> => Aug 2012" + (let* ((abbreviate 't) + (dte (org-parse-time-string date_str)) + (month (nth 4 dte)) + (year (nth 5 dte)));;'(02 07 2015))) + (concat (calendar-month-name month abbreviate) + " " +(number-to-string year)))) + (defun org-cv-cventry (headline contents info) (let ((from-date (org-element-property :FROM headline)) (to-date (org-element-property :TO headline)) (location (org-element-property :LOCATION headline)) (title (org-element-property :title headline)) + (note (org-element-property :NOTE headline)) (employer (org-element-property :EMPLOYER headline))) (format "\\cventry{%s}{%s}{%s}{%s}{%s}{%s}\n" - "start" title employer location "de paso" contents))) + (concat (org-cv-timestamp-to-shortdate from-date) + " -- " + (org-cv-timestamp-to-shortdate to-date)) + title employer location note contents))) ;;;; Headline