Suppress blank lines if a title is empty

This commit is contained in:
IGARASHI Masanao
2016-06-08 02:17:32 +09:00
parent 5bd94b7e3b
commit 958ce46c0e

View File

@@ -461,41 +461,30 @@ INFO is a plist used as a communication channel."
(org-export-data (plist-get info :email) info)))
(date (and (plist-get info :with-date)
(org-export-data (org-export-get-date info) info)))
(title
(if (string= title "")
(cond
((and (org-string-nw-p date) (org-string-nw-p author))
(concat
author
" "
date
(when (org-string-nw-p email) (concat " " email))))
((and (org-string-nw-p date) (org-string-nw-p email))
(concat
email
" "
date))
((org-string-nw-p date)
date)
((and (org-string-nw-p author) (org-string-nw-p email))
(concat author " " email))
((org-string-nw-p author) author)
((org-string-nw-p email) email)) title))
(titleline (make-string (string-width title) ?=))
(subtitleline (make-string (string-width subtitle) ?-))
(title (if (not (string= title ""))
(concat titleline "\n"
title "\n"
titleline "\n") ""))
(subtitle (if (not (string= subtitle ""))
(concat subtitleline "\n"
subtitle "\n"
subtitleline "\n") "")))
(concat
titleline "\n"
title "\n"
titleline "\n"
subtitle
(when (org-string-nw-p author) (concat "\n :Author: " author))
(when (org-string-nw-p email) (concat "\n :Contact: " email))
(when (org-string-nw-p date) (concat "\n :Date: " date))
"\n")))
(cond
((string= title "")
(concat
(when (org-string-nw-p author) (concat " :Author: " author "\n"))
(when (org-string-nw-p email) (concat " :Contact: " email "\n"))
(when (org-string-nw-p date) (concat " :Date: " date "\n"))))
(t
(concat
title
subtitle
(when (org-string-nw-p author) (concat "\n :Author: " author))
(when (org-string-nw-p email) (concat "\n :Contact: " email))
(when (org-string-nw-p date) (concat "\n :Date: " date))
"\n")))))
(defun org-rst-template (contents info)