Browse Source

ox: Remove `comment' special value for `org-export-with-creator'

* lisp/ox.el (org-export-with-creator): Change default value.

* lisp/ox-ascii.el (org-ascii-template):
* lisp/ox-beamer.el (org-beamer-template):
* lisp/ox-latex.el (org-latex-template):
* lisp/ox-odt.el (org-odt-template):
* lisp/ox-org.el (org-org-template):
* lisp/ox-texinfo.el (org-texinfo-template): Treat
  `org-export-with-creator' as a boolean.

* testing/lisp/test-ox.el (test-org-export/parse-option-keyword):
  Update test.

* doc/org.texi (Export settings): Update allowed values in
  `org-export-with-creator'.

* etc/ORG-NEWS: Signal change.

Special `comment' value isn't meaningful for all back-ends and is not
implemented in every back-end where it makes sense anyway.

It is possible to add a comment including creator at the end of the
document using a body filter instead.
Nicolas Goaziou 10 years ago
parent
commit
16cea3d7b7
10 changed files with 41 additions and 50 deletions
  1. 2 2
      doc/org.texi
  2. 4 0
      etc/ORG-NEWS
  3. 12 13
      lisp/ox-ascii.el
  4. 3 6
      lisp/ox-beamer.el
  5. 2 6
      lisp/ox-latex.el
  6. 2 1
      lisp/ox-odt.el
  7. 2 5
      lisp/ox-org.el
  8. 2 4
      lisp/ox-texinfo.el
  9. 8 8
      lisp/ox.el
  10. 4 5
      testing/lisp/test-ox.el

+ 2 - 2
doc/org.texi

@@ -10775,8 +10775,8 @@ Toggle inclusion of CLOCK keywords (@code{org-export-with-clocks}).
 
 
 @item creator:
 @item creator:
 @vindex org-export-with-creator
 @vindex org-export-with-creator
-Configure inclusion of creator info into exported file.  It may be set to
+Toggle inclusion of creator info into exported file
-@code{comment} (@code{org-export-with-creator}).
+(@code{org-export-with-creator}).
 
 
 @item d:
 @item d:
 @vindex org-export-with-drawers
 @vindex org-export-with-drawers

+ 4 - 0
etc/ORG-NEWS

@@ -96,6 +96,10 @@ compatibility.
 
 
 If you need to separate consecutive lists with blank lines, always use
 If you need to separate consecutive lists with blank lines, always use
 two of them, as if this option was nil (default value).
 two of them, as if this option was nil (default value).
+*** ~org-export-with-creator~ is a boolean
+Special ~comment~ value is no longer allowed.  It is possible to use
+a body filter to add comments about the creator at the end of the
+document instead.
 *** Removed option =org-babel-sh-command=
 *** Removed option =org-babel-sh-command=
 This undocumented option defaulted to the value of =shell-file-name=
 This undocumented option defaulted to the value of =shell-file-name=
 at the time of loading =ob-shell=.  The new behaviour is to use the
 at the time of loading =ob-shell=.  The new behaviour is to use the

+ 12 - 13
lisp/ox-ascii.el

@@ -1097,7 +1097,7 @@ CONTENTS is the transcoded contents string.  INFO is a plist
 holding export options."
 holding export options."
   (let ((global-margin (plist-get info :ascii-global-margin)))
   (let ((global-margin (plist-get info :ascii-global-margin)))
     (concat
     (concat
-     ;; 1. Build title block.
+     ;; Build title block.
      (org-ascii--indent-string
      (org-ascii--indent-string
       (concat (org-ascii-template--document-title info)
       (concat (org-ascii-template--document-title info)
 	      ;; 2. Table of contents.
 	      ;; 2. Table of contents.
@@ -1107,19 +1107,18 @@ holding export options."
 		   (org-ascii--build-toc info (and (wholenump depth) depth))
 		   (org-ascii--build-toc info (and (wholenump depth) depth))
 		   "\n\n\n"))))
 		   "\n\n\n"))))
       global-margin)
       global-margin)
-     ;; 3. Document's body.
+     ;; Document's body.
      contents
      contents
-     ;; 4. Creator.  Ignore `comment' value as there are no comments in
+     ;; Creator.  Justify it to the bottom right.
-     ;;    ASCII.  Justify it to the bottom right.
+     (and (plist-get info :with-creator)
-     (org-ascii--indent-string
+	  (org-ascii--indent-string
-      (let ((creator-info (plist-get info :with-creator))
+	   (let ((text-width
-	    (text-width (- (plist-get info :ascii-text-width) global-margin)))
+		  (- (plist-get info :ascii-text-width) global-margin)))
-	(unless (or (not creator-info) (eq creator-info 'comment))
+	     (concat
-	  (concat
+	      "\n\n\n"
-	   "\n\n\n"
+	      (org-ascii--fill-string
-	   (org-ascii--fill-string
+	       (plist-get info :creator) text-width info 'right)))
-	    (plist-get info :creator) text-width info 'right))))
+	   global-margin)))))
-      global-margin))))
 
 
 (defun org-ascii--translate (s info)
 (defun org-ascii--translate (s info)
   "Translate string S according to specified language and charset.
   "Translate string S according to specified language and charset.

+ 3 - 6
lisp/ox-beamer.el

@@ -899,12 +899,9 @@ holding export options."
      ;; 13. Document's body.
      ;; 13. Document's body.
      contents
      contents
      ;; 14. Creator.
      ;; 14. Creator.
-     (let ((creator-info (plist-get info :with-creator)))
+     (if (plist-get info :with-creator)
-       (cond
+	 (concat (plist-get info :creator) "\n")
-	((not creator-info) "")
+       "")
-	((eq creator-info 'comment)
-	 (format "%% %s\n" (plist-get info :creator)))
-	(t (concat (plist-get info :creator) "\n"))))
      ;; 15. Document end.
      ;; 15. Document end.
      "\\end{document}")))
      "\\end{document}")))
 
 

+ 2 - 6
lisp/ox-latex.el

@@ -1325,12 +1325,8 @@ holding export options."
      ;; Document's body.
      ;; Document's body.
      contents
      contents
      ;; Creator.
      ;; Creator.
-     (let ((creator-info (plist-get info :with-creator)))
+     (and (plist-get info :with-creator)
-       (cond
+	  (concat (plist-get info :creator) "\n"))
-	((not creator-info) "")
-	((eq creator-info 'comment)
-	 (format "%% %s\n" (plist-get info :creator)))
-	(t (concat (plist-get info :creator) "\n"))))
      ;; Document end.
      ;; Document end.
      "\\end{document}")))
      "\\end{document}")))
 
 

+ 2 - 1
lisp/ox-odt.el

@@ -1360,7 +1360,8 @@ original parsed data.  INFO is a plist holding export options."
 		     iso-date)))))
 		     iso-date)))))
       (format "<meta:generator>%s</meta:generator>\n"
       (format "<meta:generator>%s</meta:generator>\n"
 	      (if (plist-get info :with-creator)
 	      (if (plist-get info :with-creator)
-		  (plist-get info :creator) ""))
+		  (plist-get info :creator)
+		""))
       (format "<meta:keyword>%s</meta:keyword>\n" keywords)
       (format "<meta:keyword>%s</meta:keyword>\n" keywords)
       (format "<dc:subject>%s</dc:subject>\n" description)
       (format "<dc:subject>%s</dc:subject>\n" description)
       (format "<dc:title>%s</dc:title>\n" title)
       (format "<dc:title>%s</dc:title>\n" title)

+ 2 - 5
lisp/ox-org.el

@@ -178,17 +178,14 @@ as a communication channel."
 	(let ((email (org-export-data (plist-get info :email) info)))
 	(let ((email (org-export-data (plist-get info :email) info)))
 	  (and (org-string-nw-p email)
 	  (and (org-string-nw-p email)
 	       (format "#+EMAIL: %s\n" email))))
 	       (format "#+EMAIL: %s\n" email))))
-   (and (eq (plist-get info :with-creator) t)
+   (and (plist-get info :with-creator)
 	(org-string-nw-p (plist-get info :creator))
 	(org-string-nw-p (plist-get info :creator))
 	(format "#+CREATOR: %s\n" (plist-get info :creator)))
 	(format "#+CREATOR: %s\n" (plist-get info :creator)))
    (and (org-string-nw-p (plist-get info :keywords))
    (and (org-string-nw-p (plist-get info :keywords))
 	(format "#+KEYWORDS: %s\n" (plist-get info :keywords)))
 	(format "#+KEYWORDS: %s\n" (plist-get info :keywords)))
    (and (org-string-nw-p (plist-get info :description))
    (and (org-string-nw-p (plist-get info :description))
 	(format "#+DESCRIPTION: %s\n" (plist-get info :description)))
 	(format "#+DESCRIPTION: %s\n" (plist-get info :description)))
-   contents
+   contents))
-   (and (eq (plist-get info :with-creator) 'comment)
-	(org-string-nw-p (plist-get info :creator))
-	(format "\n# %s\n" (plist-get info :creator)))))
 
 
 (defun org-org-section (section contents info)
 (defun org-org-section (section contents info)
   "Transcode SECTION element back into Org syntax.
   "Transcode SECTION element back into Org syntax.

+ 2 - 4
lisp/ox-texinfo.el

@@ -608,10 +608,8 @@ holding export options."
      ;; Document's body.
      ;; Document's body.
      contents "\n"
      contents "\n"
      ;; Creator.
      ;; Creator.
-     (case (plist-get info :with-creator)
+     (and (plist-get info :with-creator)
-       ((nil) nil)
+	  (concat (plist-get info :creator) "\n"))
-       (comment (format "@c %s\n" (plist-get info :creator)))
-       (otherwise (concat (plist-get info :creator) "\n")))
      ;; Document end.
      ;; Document end.
      "@bye")))
      "@bye")))
 
 

+ 8 - 8
lisp/ox.el

@@ -370,18 +370,18 @@ e.g. \"c:t\"."
   :group 'org-export-general
   :group 'org-export-general
   :type 'boolean)
   :type 'boolean)
 
 
-(defcustom org-export-with-creator 'comment
+(defcustom org-export-with-creator nil
   "Non-nil means the postamble should contain a creator sentence.
   "Non-nil means the postamble should contain a creator sentence.
 
 
-The sentence can be set in `org-export-creator-string' and
+The sentence can be set in `org-export-creator-string', which
-defaults to \"Generated by Org mode XX in Emacs XXX.\".
+see.
 
 
-If the value is `comment' insert it as a comment."
+This option can also be set with the OPTIONS keyword, e.g.,
+\"creator:t\"."
   :group 'org-export-general
   :group 'org-export-general
-  :type '(choice
+  :version "25.1"
-	  (const :tag "No creator sentence" nil)
+  :package-version '(Org . "8.3")
-	  (const :tag "Sentence as a comment" comment)
+  :type 'boolean)
-	  (const :tag "Insert the sentence" t)))
 
 
 (defcustom org-export-with-date t
 (defcustom org-export-with-date t
   "Non-nil means insert date in the exported document.
   "Non-nil means insert date in the exported document.

+ 4 - 5
testing/lisp/test-ox.el

@@ -124,13 +124,12 @@ variable, and communication channel under `info'."
   (should
   (should
    (equal
    (equal
     (org-export--parse-option-keyword
     (org-export--parse-option-keyword
-     "arch:headline creator:comment d:(\"TEST\")
+     "arch:headline d:(\"TEST\") ^:{} toc:1 tags:not-in-toc tasks:todo num:2 <:active")
- ^:{} toc:1 tags:not-in-toc tasks:todo num:2 <:active")
     '( :section-numbers
     '( :section-numbers
        2
        2
-       :with-archived-trees headline :with-creator comment
+       :with-archived-trees headline :with-drawers ("TEST")
-       :with-drawers ("TEST") :with-sub-superscript {} :with-toc 1
+       :with-sub-superscript {} :with-toc 1 :with-tags not-in-toc
-       :with-tags not-in-toc :with-tasks todo :with-timestamps active))))
+       :with-tasks todo :with-timestamps active))))
 
 
 (ert-deftest test-org-export/get-inbuffer-options ()
 (ert-deftest test-org-export/get-inbuffer-options ()
   "Test reading all standard export keywords."
   "Test reading all standard export keywords."