emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Price <moptop99@gmail.com>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: [PATCH] ox-odt; make author and date lines optional
Date: Tue, 7 Jul 2015 17:55:34 -0400	[thread overview]
Message-ID: <CAN_Dec9WKcYrvdfsuNvjo3ezzYhufhcKts4pjsDWtEehHrWtqQ@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 319 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 421 bytes --]

[-- Attachment #2: 0001-Make-date-and-author-lines-optional.patch --]
[-- Type: text/x-patch, Size: 4631 bytes --]

From a18716e26db81372af47c57ad3bdf05a648c88d2 Mon Sep 17 00:00:00 2001
From: Matt Price <matt.price@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)
 
 
-\f
+
+;;;; 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


             reply	other threads:[~2015-07-07 21:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-07 21:55 Matt Price [this message]
2015-07-07 22:04 ` [PATCH] ox-odt; make author and date lines optional Rasmus
2015-07-08  1:14   ` Matt Price

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAN_Dec9WKcYrvdfsuNvjo3ezzYhufhcKts4pjsDWtEehHrWtqQ@mail.gmail.com \
    --to=moptop99@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).