hacky way to get multi-line address

This commit is contained in:
Óscar Nájera 2018-03-23 02:04:36 +01:00
parent fad1070eca
commit df20a24976

View file

@ -24,13 +24,19 @@
:options-alist :options-alist
'((:mobile "MOBILE" nil nil parse) '((:mobile "MOBILE" nil nil parse)
(:homepage "HOMEPAGE" nil nil parse) (:homepage "HOMEPAGE" nil nil parse)
(:address "ADDRESS" nil nil parse) (:address "ADDRESS" nil nil newline)
(:gitlab "GITLAB" nil nil parse) (:gitlab "GITLAB" nil nil parse)
(:github "GITHUB" nil nil parse) (:github "GITHUB" nil nil parse)
(:linkedin "LINKEDIN" nil nil parse) (:linkedin "LINKEDIN" nil nil parse)
) )
:translate-alist '((template . org-cv-template))) :translate-alist '((template . org-cv-template)))
(defun org-cv--add-latex-newlines (string)
"Replace regular newlines with LaTeX newlines (i.e. `\\\\')"
(let ((str (org-trim string)))
(when (org-string-nw-p str)
(concat (replace-regexp-in-string "\n" "\\\\\\\\\n" str) "\\\\"))))
;;;; Template ;;;; Template
;; ;;
;; Template used is similar to the one used in `latex' back-end, ;; Template used is similar to the one used in `latex' back-end,
@ -80,7 +86,7 @@ holding export options."
(when linkedin (format "\\social[linkedin]{%s}\n" linkedin))) (when linkedin (format "\\social[linkedin]{%s}\n" linkedin)))
;; address ;; address
(let ((address (org-export-data (plist-get info :address) info))) (let ((address (org-export-data (plist-get info :address) info)))
(when address (format "\\address{%s}\n" address))) (when address (format "\\address{%s}\n" (org-cv--add-latex-newlines address))))
;; Date. ;; Date.
(let ((date (and (plist-get info :with-date) (org-export-get-date info)))) (let ((date (and (plist-get info :with-date) (org-export-get-date info))))
(format "\\date{%s}\n" (org-export-data date info))) (format "\\date{%s}\n" (org-export-data date info)))