mirror of
https://gitlab.com/Titan-C/org-cv.git
synced 2024-11-14 18:48:30 +00:00
unify parsing of cventry
This commit is contained in:
parent
395069b130
commit
cb32990168
4 changed files with 34 additions and 29 deletions
|
@ -54,5 +54,17 @@ in case TO-DATE is nil return Present"
|
||||||
(if (not to-date) "Present"
|
(if (not to-date) "Present"
|
||||||
(org-cv-utils-org-timestamp-to-shortdate to-date))))
|
(org-cv-utils-org-timestamp-to-shortdate to-date))))
|
||||||
|
|
||||||
|
(defun org-cv-utils--parse-cventry (headline info)
|
||||||
|
"Return alist describing the entry
|
||||||
|
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)))
|
||||||
|
(to-date . ,(org-element-property :TO headline))
|
||||||
|
(employer . ,(org-element-property :EMPLOYER headline))
|
||||||
|
(location . ,(or (org-element-property :LOCATION headline) "")))))
|
||||||
|
|
||||||
(provide 'org-cv-utils)
|
(provide 'org-cv-utils)
|
||||||
;;; org-cv-utils ends here
|
;;; org-cv-utils ends here
|
||||||
|
|
16
ox-altacv.el
16
ox-altacv.el
|
@ -193,18 +193,14 @@ holding export options."
|
||||||
"Format HEADLINE as as cventry.
|
"Format HEADLINE as as cventry.
|
||||||
CONTENTS holds the contents of the headline. INFO is a plist used
|
CONTENTS holds the contents of the headline. INFO is a plist used
|
||||||
as a communication channel."
|
as a communication channel."
|
||||||
(let* ((title (org-export-data (org-element-property :title headline) info))
|
(let* ((entry (org-cv-utils--parse-cventry 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) "\n" "\\divider")))
|
(divider (if (org-export-last-sibling-p headline info) "\n" "\\divider")))
|
||||||
(format "\n\\cvevent{%s}{%s}{%s}{%s}%s\n%s"
|
(format "\n\\cvevent{%s}{%s}{%s}{%s}%s\n%s"
|
||||||
title
|
(alist-get 'title entry)
|
||||||
employer
|
(alist-get 'employer entry)
|
||||||
(org-cv-utils--format-time-window from-date to-date)
|
(org-cv-utils--format-time-window (alist-get 'from-date entry)
|
||||||
location contents divider)))
|
(alist-get 'to-date entry))
|
||||||
|
(alist-get 'location entry) contents divider)))
|
||||||
|
|
||||||
;;;; Headline
|
;;;; Headline
|
||||||
(defun org-altacv-headline (headline contents info)
|
(defun org-altacv-headline (headline contents info)
|
||||||
|
|
17
ox-hugocv.el
17
ox-hugocv.el
|
@ -60,13 +60,10 @@
|
||||||
"Format HEADLINE as as cventry.
|
"Format HEADLINE as as cventry.
|
||||||
CONTENTS holds the contents of the headline. INFO is a plist used
|
CONTENTS holds the contents of the headline. INFO is a plist used
|
||||||
as a communication channel."
|
as a communication channel."
|
||||||
(let* ((title (org-export-data (org-element-property :title headline) info))
|
(let* ((entry (org-cv-utils--parse-cventry 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, ..
|
(loffset (string-to-number (plist-get info :hugo-level-offset))) ;"" -> 0, "0" -> 0, "1" -> 1, ..
|
||||||
(level (org-export-get-relative-level headline info))
|
(level (org-export-get-relative-level headline info))
|
||||||
(employer (org-element-property :EMPLOYER headline))
|
(title (concat (make-string (+ loffset level) ?#) " " (alist-get 'title entry))))
|
||||||
(location (or (org-element-property :LOCATION headline) "")))
|
|
||||||
(format "\n%s
|
(format "\n%s
|
||||||
|
|
||||||
<ul class=\"cventry\">
|
<ul class=\"cventry\">
|
||||||
|
@ -76,14 +73,14 @@ as a communication channel."
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
%s
|
%s
|
||||||
"
|
" title
|
||||||
(concat (make-string (+ loffset level) ?#) " " title)
|
(alist-get 'employer entry)
|
||||||
employer
|
(alist-get 'location entry)
|
||||||
location
|
(org-cv-utils--format-time-window (alist-get 'from-date entry) (alist-get 'to-date entry))
|
||||||
(org-cv-utils--format-time-window from-date to-date)
|
|
||||||
contents)))
|
contents)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;;; Headline
|
;;;; Headline
|
||||||
(defun org-hugocv-headline (headline contents info)
|
(defun org-hugocv-headline (headline contents info)
|
||||||
"Transcode HEADLINE element into hugocv code.
|
"Transcode HEADLINE element into hugocv code.
|
||||||
|
|
|
@ -183,16 +183,16 @@ holding export options."
|
||||||
"Format HEADLINE as as cventry.
|
"Format HEADLINE as as cventry.
|
||||||
CONTENTS holds the contents of the headline. INFO is a plist used
|
CONTENTS holds the contents of the headline. INFO is a plist used
|
||||||
as a communication channel."
|
as a communication channel."
|
||||||
(let* ((title (org-export-data (org-element-property :title headline) info))
|
(let* ((entry (org-cv-utils--parse-cventry 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) "")))
|
(note (or (org-element-property :NOTE headline) "")))
|
||||||
(format "\\cventry{\\textbf{%s}}{%s}{%s}{%s}{%s}{%s}\n"
|
|
||||||
(org-cv-utils--format-time-window from-date to-date)
|
|
||||||
title employer location note contents)))
|
|
||||||
|
|
||||||
|
(format "\\cventry{\\textbf{%s}}{%s}{%s}{%s}{%s}{%s}\n"
|
||||||
|
(org-cv-utils--format-time-window (alist-get 'from-date entry)
|
||||||
|
(alist-get 'to-date entry))
|
||||||
|
(alist-get 'title entry)
|
||||||
|
(alist-get 'employer entry)
|
||||||
|
(alist-get 'location entry)
|
||||||
|
note contents)))
|
||||||
|
|
||||||
;;;; Headline
|
;;;; Headline
|
||||||
(defun org-moderncv-headline (headline contents info)
|
(defun org-moderncv-headline (headline contents info)
|
||||||
|
|
Loading…
Reference in a new issue