all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] ox-odt; make author and date lines optional
@ 2015-07-07 21:55 Matt Price
  2015-07-07 22:04 ` Rasmus
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Price @ 2015-07-07 21:55 UTC (permalink / raw)
  To: Org Mode


[-- 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ox-odt; make author and date lines optional
  2015-07-07 21:55 [PATCH] ox-odt; make author and date lines optional Matt Price
@ 2015-07-07 22:04 ` Rasmus
  2015-07-08  1:14   ` Matt Price
  0 siblings, 1 reply; 3+ messages in thread
From: Rasmus @ 2015-07-07 22:04 UTC (permalink / raw)
  To: emacs-orgmode

Matt Price <moptop99@gmail.com> writes:

> 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.

Can you explain what is the difference between this and something like:

#+options: author:nil date:nil

-- 
And I faced endless streams of vendor-approved Ikea furniture. . .

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ox-odt; make author and date lines optional
  2015-07-07 22:04 ` Rasmus
@ 2015-07-08  1:14   ` Matt Price
  0 siblings, 0 replies; 3+ messages in thread
From: Matt Price @ 2015-07-08  1:14 UTC (permalink / raw)
  To: Org Mode

[-- Attachment #1: Type: text/plain, Size: 726 bytes --]

ha!  I thought odt export didn't honor those variables -- but I must have
had something wrong in my environment, because now I see that it does.
Sorry to waste your time!


m

On Tue, Jul 7, 2015, 18:04 Rasmus <rasmus@gmx.us> wrote:

> Matt Price <moptop99@gmail.com> writes:
>
> > 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.
>
> Can you explain what is the difference between this and something like:
>
> #+options: author:nil date:nil
>
> --
> And I faced endless streams of vendor-approved Ikea furniture. . .
>
>
>

[-- Attachment #2: Type: text/html, Size: 1133 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-08  1:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-07 21:55 [PATCH] ox-odt; make author and date lines optional Matt Price
2015-07-07 22:04 ` Rasmus
2015-07-08  1:14   ` Matt Price

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.