From c6d709d0ed99b6d7f6f3799ab2fec3a5def2d07c Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Fri, 9 Nov 2012 11:04:07 +0100 Subject: [PATCH] org-export: Allow to toggle date insertion * contrib/lisp/org-export.el (org-export-with-date): New variable. (org-export-options-alist): Use new variable. * contrib/lisp/org-e-ascii.el (org-e-ascii-template--document-title): Check `:with-date' property in communication channel. * contrib/lisp/org-e-beamer.el (org-e-beamer-template): Check `:with-date' property in communication channel. * contrib/lisp/org-e-groff.el (org-e-groff--mt-head): Check `:with-date' property in communication channel. (org-e-groff-date-format): Remove variable. * contrib/lisp/org-e-html.el (org-e-html--build-meta-info, org-e-html--build-preamble, org-e-html--build-postamble): Check `:with-date' property in communication channel. (org-e-html-format-date): Remove variable. * contrib/lisp/org-e-latex.el (org-e-latex-template): Check `:with-date' property in communication channel. contrib/lisp/org-e-man.el: Do not redefine DATE keyword. --- contrib/lisp/org-e-ascii.el | 3 ++- contrib/lisp/org-e-beamer.el | 3 ++- contrib/lisp/org-e-groff.el | 15 ++++----------- contrib/lisp/org-e-html.el | 31 ++++++++++++++----------------- contrib/lisp/org-e-latex.el | 5 +++-- contrib/lisp/org-e-man.el | 3 +-- contrib/lisp/org-export.el | 14 ++++++++++++-- 7 files changed, 38 insertions(+), 36 deletions(-) diff --git a/contrib/lisp/org-e-ascii.el b/contrib/lisp/org-e-ascii.el index 46906c36b..1d9619f49 100644 --- a/contrib/lisp/org-e-ascii.el +++ b/contrib/lisp/org-e-ascii.el @@ -819,7 +819,8 @@ INFO is a plist used as a communication channel." (and auth (org-export-data auth info))))) (email (and (plist-get info :with-email) (org-export-data (plist-get info :email) info))) - (date (org-export-data (plist-get info :date) info))) + (date (and (plist-get info :with-date) + (org-export-data (plist-get info :date) info)))) ;; There are two types of title blocks depending on the presence ;; of a title to display. (if (string= title "") diff --git a/contrib/lisp/org-e-beamer.el b/contrib/lisp/org-e-beamer.el index 8743cc2f3..ef5fb7ea5 100644 --- a/contrib/lisp/org-e-beamer.el +++ b/contrib/lisp/org-e-beamer.el @@ -860,7 +860,8 @@ holding export options." (author (format "\\author{%s}\n" author)) (t "\\author{}\n"))) ;; 6. Date. - (format "\\date{%s}\n" (org-export-data (plist-get info :date) info)) + (when (plist-get info :with-date) + (format "\\date{%s}\n" (org-export-data (plist-get info :date) info))) ;; 7. Title (format "\\title{%s}\n" title) ;; 8. Hyperref options. diff --git a/contrib/lisp/org-e-groff.el b/contrib/lisp/org-e-groff.el index 94f0cf902..81a7363a9 100644 --- a/contrib/lisp/org-e-groff.el +++ b/contrib/lisp/org-e-groff.el @@ -102,8 +102,7 @@ (?o "As PDF file and open" (lambda (s v b) (org-open-file (org-e-groff-export-to-pdf s v b)))))) :options-alist - ((:date "DATE" nil org-e-groff-date-format t) - (:groff-class "GROFF_CLASS" nil org-e-groff-default-class t) + ((:groff-class "GROFF_CLASS" nil org-e-groff-default-class t) (:groff-class-options "GROFF_CLASS_OPTIONS" nil nil t) (:groff-header-extra "GROFF_HEADER" nil nil newline))) @@ -171,13 +170,6 @@ (list :tag "Heading") (function :tag "Hook computing sectioning")))))) - -(defcustom org-e-groff-date-format - (format-time-string "%Y-%m-%d") - "Format string for .ND " - :group 'org-export-e-groff - :type 'boolean) - ;;; Headline (defconst org-e-groff-special-tags @@ -627,8 +619,9 @@ See `org-e-groff-text-markup-alist' for details." "")) ;; 5. Date. - (let ((date (org-export-data (plist-get info :date) info))) - (and date (format ".ND \"%s\"\n" date))) + (when (plist-get info :with-date) + (let ((date (org-export-data (plist-get info :date) info))) + (and date (format ".ND \"%s\"\n" date)))) ;; ;; If Abstract, then Populate Abstract diff --git a/contrib/lisp/org-e-html.el b/contrib/lisp/org-e-html.el index 5232951ba..b6793de7d 100644 --- a/contrib/lisp/org-e-html.el +++ b/contrib/lisp/org-e-html.el @@ -1190,14 +1190,6 @@ Replaces invalid characters with \"_\"." "\n%s\n
\n" (mapconcat 'org-e-html-format-footnote-definition fn-alist "\n")))))) -(defun org-e-html-format-date (info) - (let ((date (org-export-data (plist-get info :date) info))) - (cond - ((and date (string-match "%" date)) - (format-time-string date)) - (date date) - (t (format-time-string "%Y-%m-%d %T %Z"))))) - ;;; Template @@ -1209,6 +1201,9 @@ INFO is a plist used as a communication channel." (author (and (plist-get info :with-author) (let ((auth (plist-get info :author))) (and auth (org-export-data auth info))))) + (date (and (plist-get info :with-date) + (let ((date (plist-get info :date))) + (and date (org-export-data date info))))) (description (plist-get info :description)) (keywords (plist-get info :keywords))) (concat @@ -1217,16 +1212,16 @@ INFO is a plist used as a communication channel." "" (or (and org-e-html-coding-system (fboundp 'coding-system-get) - (coding-system-get org-e-html-coding-system - 'mime-charset)) + (coding-system-get org-e-html-coding-system 'mime-charset)) "iso-8859-1")) (format "\n" title) (format "\n") - (format "\n" - (org-e-html-format-date info)) - (format "\n" author) - (format "\n" description) - (format "\n" keywords)))) + (and date (format "\n" date)) + (and author (format "\n" author)) + (and description + (format "\n" description)) + (and keywords + (format "\n" keywords))))) (defun org-e-html--build-style (info) "Return style information for exported document. @@ -1278,7 +1273,8 @@ INFO is a plist used as a communication channel." (let ((preamble-contents (if (functionp preamble) (funcall preamble info) (let ((title (org-export-data (plist-get info :title) info)) - (date (org-e-html-format-date info)) + (date (if (not (plist-get info :with-date)) "" + (org-export-data (plist-get info :date) info))) (author (if (not (plist-get info :with-author)) "" (org-export-data (plist-get info :author) info))) (email (if (not (plist-get info :with-email)) "" @@ -1305,7 +1301,8 @@ INFO is a plist used as a communication channel." (when postamble (let ((postamble-contents (if (functionp postamble) (funcall postamble info) - (let ((date (org-e-html-format-date info)) + (let ((date (if (not (plist-get info :with-date)) "" + (org-export-data (plist-get info :date) info))) (author (let ((author (plist-get info :author))) (and author (org-export-data author info)))) (email (mapconcat diff --git a/contrib/lisp/org-e-latex.el b/contrib/lisp/org-e-latex.el index 6922cda13..64908b9f0 100644 --- a/contrib/lisp/org-e-latex.el +++ b/contrib/lisp/org-e-latex.el @@ -1026,8 +1026,9 @@ holding export options." (format "\\author{%s\\thanks{%s}}\n" author email)) ((or author email) (format "\\author{%s}\n" (or author email))))) ;; Date. - (let ((date (org-export-data (plist-get info :date) info))) - (and date (format "\\date{%s}\n" date))) + (when (plist-get info :with-date) + (let ((date (org-export-data (plist-get info :date) info))) + (and date (format "\\date{%s}\n" date)))) ;; Title (format "\\title{%s}\n" title) ;; Hyperref options. diff --git a/contrib/lisp/org-e-man.el b/contrib/lisp/org-e-man.el index f8e7f5bb7..bafd0c0bd 100644 --- a/contrib/lisp/org-e-man.el +++ b/contrib/lisp/org-e-man.el @@ -110,8 +110,7 @@ (?o "As PDF file and open" (lambda (s v b) (org-open-file (org-e-man-export-to-pdf s v b)))))) :options-alist - ((:date "DATE" nil nil t) - (:man-class "MAN_CLASS" nil nil t) + ((:man-class "MAN_CLASS" nil nil t) (:man-class-options "MAN_CLASS_OPTIONS" nil nil t) (:man-header-extra "MAN_HEADER" nil nil newline))) diff --git a/contrib/lisp/org-export.el b/contrib/lisp/org-export.el index fd67707e2..f87ab3ec1 100644 --- a/contrib/lisp/org-export.el +++ b/contrib/lisp/org-export.el @@ -115,6 +115,7 @@ (:with-author nil "author" org-export-with-author) (:with-clocks nil "c" org-export-with-clocks) (:with-creator nil "creator" org-export-with-creator) + (:with-date nil "date" org-export-with-date) (:with-drawers nil "d" org-export-with-drawers) (:with-email nil "email" org-export-with-email) (:with-emphasize nil "*" org-export-with-emphasize) @@ -314,6 +315,11 @@ If the value is `comment' insert it as a comment." (const :tag "Sentence as a comment" 'comment) (const :tag "Insert the sentence" t))) +(defcustom org-export-with-date t + "Non-nil means insert date in the exported document. +This options can also be set with the OPTIONS keyword, +e.g. \"date:nil\".") + (defcustom org-export-creator-string (format "Generated by Org mode %s in Emacs %s." (if (fboundp 'org-version) (org-version) "(Unknown)") @@ -1160,16 +1166,20 @@ structure of the values." ;; - category :: option ;; - type :: symbol (nil, t) ;; -;; + `:with-clocks' :: Non-nild means clock keywords should be exported. +;; + `:with-clocks' :: Non-nil means clock keywords should be exported. ;; - category :: option ;; - type :: symbol (nil, t) ;; -;; + `:with-creator' :: Non-nild means a creation sentence should be +;; + `:with-creator' :: Non-nil means a creation sentence should be ;; inserted at the end of the transcoded string. If the value ;; is `comment', it should be commented. ;; - category :: option ;; - type :: symbol (`comment', nil, t) ;; +;; + `:with-date' :: Non-nil means output should contain a date. +;; - category :: option +;; - type :. symbol (nil, t) +;; ;; + `:with-drawers' :: Non-nil means drawers should be exported. If ;; its value is a list of names, only drawers with such names ;; will be transcoded.