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))) (org-export-data (plist-get info :email) info)))
(date (and (plist-get info :with-date) (date (and (plist-get info :with-date)
(org-export-data (org-export-get-date info) info))) (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) ?=)) (titleline (make-string (string-width title) ?=))
(subtitleline (make-string (string-width subtitle) ?-)) (subtitleline (make-string (string-width subtitle) ?-))
(title (if (not (string= title ""))
(concat titleline "\n"
title "\n"
titleline "\n") ""))
(subtitle (if (not (string= subtitle "")) (subtitle (if (not (string= subtitle ""))
(concat subtitleline "\n" (concat subtitleline "\n"
subtitle "\n" subtitle "\n"
subtitleline "\n") ""))) subtitleline "\n") "")))
(cond
((string= title "")
(concat (concat
titleline "\n" (when (org-string-nw-p author) (concat " :Author: " author "\n"))
title "\n" (when (org-string-nw-p email) (concat " :Contact: " email "\n"))
titleline "\n" (when (org-string-nw-p date) (concat " :Date: " date "\n"))))
(t
(concat
title
subtitle subtitle
(when (org-string-nw-p author) (concat "\n :Author: " author)) (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 email) (concat "\n :Contact: " email))
(when (org-string-nw-p date) (concat "\n :Date: " date)) (when (org-string-nw-p date) (concat "\n :Date: " date))
"\n"))) "\n")))))
(defun org-rst-template (contents info) (defun org-rst-template (contents info)