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.
This commit is contained in:
Nicolas Goaziou 2015-03-17 15:40:52 +01:00
parent fd8c843692
commit 16cea3d7b7
10 changed files with 41 additions and 50 deletions

View File

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

View File

@ -96,6 +96,10 @@ compatibility.
If you need to separate consecutive lists with blank lines, always use
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=
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

View File

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

View File

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

View File

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

View File

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

View File

@ -178,17 +178,14 @@ as a communication channel."
(let ((email (org-export-data (plist-get info :email) info)))
(and (org-string-nw-p 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))
(format "#+CREATOR: %s\n" (plist-get info :creator)))
(and (org-string-nw-p (plist-get info :keywords))
(format "#+KEYWORDS: %s\n" (plist-get info :keywords)))
(and (org-string-nw-p (plist-get info :description))
(format "#+DESCRIPTION: %s\n" (plist-get info :description)))
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)))))
contents))
(defun org-org-section (section contents info)
"Transcode SECTION element back into Org syntax.

View File

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

View File

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

View File

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