فهرست منبع

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.
Nicolas Goaziou 12 سال پیش
والد
کامیت
c6d709d0ed

+ 2 - 1
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 "")

+ 2 - 1
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.

+ 4 - 11
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

+ 14 - 17
contrib/lisp/org-e-html.el

@@ -1190,14 +1190,6 @@ Replaces invalid characters with \"_\"."
 	"<table>\n%s\n</table>\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."
       "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=%s\"/>"
       (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 "<meta name=\"title\" content=\"%s\"/>\n" title)
      (format "<meta name=\"generator\" content=\"Org-mode\"/>\n")
-     (format "<meta name=\"generated\" content=\"%s\"/>\n"
-	     (org-e-html-format-date info))
-     (format "<meta name=\"author\" content=\"%s\"/>\n" author)
-     (format "<meta name=\"description\" content=\"%s\"/>\n" description)
-     (format "<meta name=\"keywords\" content=\"%s\"/>\n" keywords))))
+     (and date (format "<meta name=\"generated\" content=\"%s\"/>\n" date))
+     (and author (format "<meta name=\"author\" content=\"%s\"/>\n" author))
+     (and description
+	  (format "<meta name=\"description\" content=\"%s\"/>\n" description))
+     (and keywords
+	  (format "<meta name=\"keywords\" content=\"%s\"/>\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

+ 3 - 2
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.

+ 1 - 2
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)))
 

+ 12 - 2
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.