Default FROM as error and TO as "Present"

If no FROM property is provided for a given cventry, throw an error.  If no
TO property is provided, use the atom "Present".
This commit is contained in:
Joseph LaFreniere 2018-09-14 04:17:06 -05:00 committed by Óscar Nájera
parent 4e059491c0
commit daf7295688
3 changed files with 28 additions and 22 deletions

View file

@ -204,18 +204,20 @@ e.g. <2002-08-12 Mon> => Aug 2012"
"Format HEADLINE as as cventry.
CONTENTS holds the contents of the headline. INFO is a plist used
as a communication channel."
(let ((from-date (org-element-property :FROM headline))
(to-date (org-element-property :TO headline))
(title (org-export-data (org-element-property :title headline) info))
(employer (org-element-property :EMPLOYER headline))
(location (or (org-element-property :LOCATION headline) ""))
(divider (if (org-export-last-sibling-p headline info) "" "\\divider")))
(let* ((title (org-export-data (org-element-property :title headline) info))
(from-date (or (org-element-property :FROM headline) (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) ""))
(divider (if (org-export-last-sibling-p headline info) "" "\\divider")))
(format "\n\\cvevent{%s}{%s}{%s}{%s}%s\n%s"
title
employer
(concat (org-altacv-timestamp-to-shortdate from-date)
" -- "
(org-altacv-timestamp-to-shortdate to-date))
(if (not to-date)
"Present"
(org-moderncv-timestamp-to-shortdate to-date)))
location contents divider)))

View file

@ -70,13 +70,13 @@ e.g. <2002-08-12 Mon> => Aug 2012"
"Format HEADLINE as as cventry.
CONTENTS holds the contents of the headline. INFO is a plist used
as a communication channel."
(let ((from-date (org-element-property :FROM headline))
(to-date (org-element-property :TO headline))
(loffset (string-to-number (plist-get info :hugo-level-offset))) ;"" -> 0, "0" -> 0, "1" -> 1, ..
(level (org-export-get-relative-level headline info))
(title (org-export-data (org-element-property :title headline) info))
(employer (org-element-property :EMPLOYER headline))
(location (or (org-element-property :LOCATION headline) "")))
(let* ((title (org-export-data (org-element-property :title headline) info))
(from-date (or (org-element-property :FROM headline) (error "No FROM property provided for cventry %s" title)))
(to-date (org-element-property :TO headline))
(loffset (string-to-number (plist-get info :hugo-level-offset))) ;"" -> 0, "0" -> 0, "1" -> 1, ..
(level (org-export-get-relative-level headline info))
(employer (org-element-property :EMPLOYER headline))
(location (or (org-element-property :LOCATION headline) "")))
(format "\n%s
<ul class=\"cventry\">
@ -92,7 +92,9 @@ as a communication channel."
location
(concat (org-hugocv-timestamp-to-shortdate from-date)
" -- "
(org-hugocv-timestamp-to-shortdate to-date))
(if (not to-date)
"Present"
(org-moderncv-timestamp-to-shortdate to-date)))
contents)))

View file

@ -194,16 +194,18 @@ e.g. <2002-08-12 Mon> => Aug 2012"
"Format HEADLINE as as cventry.
CONTENTS holds the contents of the headline. INFO is a plist used
as a communication channel."
(let ((from-date (org-element-property :FROM headline))
(to-date (org-element-property :TO headline))
(title (org-export-data (org-element-property :title headline) info))
(employer (org-element-property :EMPLOYER headline))
(location (or (org-element-property :LOCATION headline) ""))
(note (or (org-element-property :NOTE headline) "")))
(let* ((title (org-export-data (org-element-property :title headline) info))
(from-date (or (org-element-property :FROM headline) (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) ""))
(note (or (org-element-property :NOTE headline) "")))
(format "\\cventry{\\textbf{%s}}{%s}{%s}{%s}{%s}{%s}\n"
(concat (org-moderncv-timestamp-to-shortdate from-date)
" -- "
(org-moderncv-timestamp-to-shortdate to-date))
(if (not to-date)
"Present"
(org-moderncv-timestamp-to-shortdate to-date)))
title employer location note contents)))