From a18716e26db81372af47c57ad3bdf05a648c88d2 Mon Sep 17 00:00:00 2001 From: Matt Price Date: Tue, 7 Jul 2015 17:30:58 -0400 Subject: [PATCH] Make date and author lines optional. * ox-odt.el (org-odt-print-author-line, org-odt-print-date-line) Adds defcustoms org-odt-print-author-line and org-odt-print-date-line, which, when non-nil, suppress these elements in the final exported odt. --- lisp/ox-odt.el | 93 +++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 57 insertions(+), 36 deletions(-) diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index 163f580..1739c96 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -950,7 +950,27 @@ See `org-odt--build-date-styles' for implementation details." :type 'boolean) - + +;;;; First Page Properties +(defcustom org-odt-print-author-line t + "Specify whether or not to include an author line below the title in +the exported document. When set to nil, the author line will be +suppressed At present, setting to nil will also suppress +printing of author's email." + :group 'org-export-odt + :version "24.1" + :type 'boolean) + +(defcustom org-odt-print-date-line t + "Specify whether or not to include a date line below the title in +the exported document. When set to nil, the author line will be +suppressed At present, setting to nil will also suppress +printing of author's email." + :group 'org-export-odt + :version "24.1" + :type 'boolean) + + ;;; Internal functions ;;;; Date @@ -1543,43 +1563,44 @@ original parsed data. INFO is a plist holding export options." "\n")) ;; Separator. "\n")))) - (cond - ((and author (not email)) - ;; Author only. - (concat - (format "\n%s" + (when org-odt-print-author-line (cond + ((and author (not email)) + ;; Author only. + (concat + (format "\n%s" + "OrgSubtitle" + (format "%s" author)) + ;; Separator. + "\n")) + ((and author email) + ;; Author and E-mail. + (concat + (format + "\n%s" "OrgSubtitle" - (format "%s" author)) - ;; Separator. - "\n")) - ((and author email) - ;; Author and E-mail. - (concat - (format - "\n%s" - "OrgSubtitle" - (format - "%s" - (concat "mailto:" email) - (format "%s" author))) - ;; Separator. - "\n"))) + (format + "%s" + (concat "mailto:" email) + (format "%s" author))) + ;; Separator. + "\n")))) ;; Date, if required. - (when (plist-get info :with-date) - (let* ((date (plist-get info :date)) - ;; Check if DATE is specified as a timestamp. - (timestamp (and (not (cdr date)) - (eq (org-element-type (car date)) 'timestamp) - (car date)))) - (when date - (concat - (format "\n%s" - "OrgSubtitle" - (if (and (plist-get info :odt-use-date-fields) timestamp) - (org-odt--format-timestamp (car date)) - (org-export-data date info))) - ;; Separator - ""))))))) + (when org-odt-print-date-line (when (plist-get info :with-date) + (let* ((date (plist-get info :date)) + ;; Check if DATE is specified as a timestamp. + (timestamp (and (not (cdr date)) + (eq (org-element-type (car date)) 'timestamp) + (car date)))) + (when date + (concat + (format "\n%s" + "OrgSubtitle" + (if (and (plist-get info :odt-use-date-fields) timestamp) + (org-odt--format-timestamp (car date)) + (org-export-data date info))) + ;; Separator + ""))))) + ))) ;; Table of Contents (let* ((with-toc (plist-get info :with-toc)) (depth (and with-toc (if (wholenump with-toc) -- 2.4.3