Hi, The simple attached patch adds 2 defcustoms to org-odt, allowing the author and date lines to be suppressed in the exported file. I have wnated this for a really long time, so submitting to the group in cas other people also want it.
I would have liked to add this as an option but don't know how! Thanks, Matt
From a18716e26db81372af47c57ad3bdf05a648c88d2 Mon Sep 17 00:00:00 2001 From: Matt Price <matt.pr...@utoronto.ca> 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." "</text:user-defined>\n")) ;; Separator. "<text:p text:style-name=\"OrgSubtitle\"/>\n")))) - (cond - ((and author (not email)) - ;; Author only. - (concat - (format "\n<text:p text:style-name=\"%s\">%s</text:p>" + (when org-odt-print-author-line (cond + ((and author (not email)) + ;; Author only. + (concat + (format "\n<text:p text:style-name=\"%s\">%s</text:p>" + "OrgSubtitle" + (format "<text:initial-creator>%s</text:initial-creator>" author)) + ;; Separator. + "\n<text:p text:style-name=\"OrgSubtitle\"/>")) + ((and author email) + ;; Author and E-mail. + (concat + (format + "\n<text:p text:style-name=\"%s\">%s</text:p>" "OrgSubtitle" - (format "<text:initial-creator>%s</text:initial-creator>" author)) - ;; Separator. - "\n<text:p text:style-name=\"OrgSubtitle\"/>")) - ((and author email) - ;; Author and E-mail. - (concat - (format - "\n<text:p text:style-name=\"%s\">%s</text:p>" - "OrgSubtitle" - (format - "<text:a xlink:type=\"simple\" xlink:href=\"%s\">%s</text:a>" - (concat "mailto:" email) - (format "<text:initial-creator>%s</text:initial-creator>" author))) - ;; Separator. - "\n<text:p text:style-name=\"OrgSubtitle\"/>"))) + (format + "<text:a xlink:type=\"simple\" xlink:href=\"%s\">%s</text:a>" + (concat "mailto:" email) + (format "<text:initial-creator>%s</text:initial-creator>" author))) + ;; Separator. + "\n<text:p text:style-name=\"OrgSubtitle\"/>")))) ;; 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<text:p text:style-name=\"%s\">%s</text:p>" - "OrgSubtitle" - (if (and (plist-get info :odt-use-date-fields) timestamp) - (org-odt--format-timestamp (car date)) - (org-export-data date info))) - ;; Separator - "<text:p text:style-name=\"OrgSubtitle\"/>"))))))) + (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<text:p text:style-name=\"%s\">%s</text:p>" + "OrgSubtitle" + (if (and (plist-get info :odt-use-date-fields) timestamp) + (org-odt--format-timestamp (car date)) + (org-export-data date info))) + ;; Separator + "<text:p text:style-name=\"OrgSubtitle\"/>"))))) + ))) ;; Table of Contents (let* ((with-toc (plist-get info :with-toc)) (depth (and with-toc (if (wholenump with-toc) -- 2.4.3