Browse Source

Export back-ends: Update timestamp export

* contrib/lisp/org-e-ascii.el (org-e-ascii-timestamp): Update
  timestamp export.
* contrib/lisp/org-e-groff.el (org-e-groff-timestamp): Update
  timestamp export.
* contrib/lisp/org-e-html.el (org-e-html-timestamp): Update timestamp
  export.
* contrib/lisp/org-e-latex.el (org-e-latex-timestamp): Update
  timestamp export.
* contrib/lisp/org-e-odt.el (org-e-odt-timestamp): Update timestamp
  export.
* contrib/lisp/org-e-texinfo.el (org-e-texinfo-timestamp): Update
  timestamp export.
Nicolas Goaziou 5 years ago
parent
commit
f6e936c2b9

+ 4 - 6
contrib/lisp/org-e-ascii.el

@@ -1724,12 +1724,10 @@ a communication channel."
 (defun org-e-ascii-timestamp (timestamp contents info)
   "Transcode a TIMESTAMP object from Org to ASCII.
 CONTENTS is nil.  INFO is a plist holding contextual information."
-  (let ((value (org-translate-time (org-element-property :value timestamp)))
-	(range-end
-	 (org-translate-time (org-element-property :range-end timestamp)))
-	(utf8p (eq (plist-get info :ascii-charset) 'utf-8)))
-    (concat value
-	    (when range-end (concat (if utf8p "–" "--") range-end)))))
+  (let ((value (org-translate-time
+		(org-element-property :raw-value timestamp))))
+    (if (not (eq (plist-get info :ascii-charset) 'utf-8)) value
+      (replace-regexp-in-string "--" "–" value))))
 
 
 ;;;; Underline

+ 8 - 7
contrib/lisp/org-e-groff.el

@@ -1851,13 +1851,14 @@ information."
   "Transcode a TIMESTAMP object from Org to Groff.
 CONTENTS is nil.  INFO is a plist holding contextual
 information."
-  (let ((value (org-translate-time (org-element-property :value timestamp)))
-        (type (org-element-property :type timestamp)))
-    (cond ((memq type '(active active-range))
-           (format org-e-groff-active-timestamp-format value))
-          ((memq type '(inactive inactive-range))
-           (format org-e-groff-inactive-timestamp-format value))
-          (t (format org-e-groff-diary-timestamp-format value)))))
+  (let ((value (org-translate-time
+		(org-element-property :raw-value timestamp))))
+    (case (org-element-property :type timestamp)
+      ((active active-range)
+       (format org-e-groff-active-timestamp-format value))
+      ((inactive inactive-range)
+       (format org-e-groff-inactive-timestamp-format value))
+      (t (format org-e-groff-diary-timestamp-format value)))))
 
 ;;; Underline
 

+ 3 - 5
contrib/lisp/org-e-html.el

@@ -2702,12 +2702,10 @@ information."
   "Transcode a TIMESTAMP object from Org to HTML.
 CONTENTS is nil.  INFO is a plist holding contextual
 information."
-  (let* ((f (if (eq (org-element-property :type timestamp) 'inactive) "[%s]" "<%s>"))
-	 (value (org-translate-time (format f (org-element-property :value timestamp))))
-	 (range-end (org-element-property :range-end timestamp)))
+  (let ((value (org-translate-time
+		(org-element-property :raw-value timestamp))))
     (format "<span class=\"timestamp-wrapper\"><span class=\"timestamp\">%s</span></span>"
-	    (if (not range-end) value
-	      (concat value "&ndash;" (org-translate-time (format f range-end)))))))
+	    (replace-regexp-in-string "--" "&ndash;" value))))
 
 
 ;;;; Underline

+ 12 - 10
contrib/lisp/org-e-latex.el

@@ -2452,21 +2452,23 @@ information."
   "Transcode a TIMESTAMP object from Org to LaTeX.
 CONTENTS is nil.  INFO is a plist holding contextual
 information."
-  (let ((value (org-translate-time (org-element-property :value timestamp)))
-	(range-end (org-element-property :range-end timestamp)))
+  (let ((value (org-translate-time
+		(org-element-property :raw-value timestamp))))
     (case (org-element-property :type timestamp)
       (active (format org-e-latex-active-timestamp-format value))
       (active-range
-       (concat (format org-e-latex-active-timestamp-format value)
-	       "--"
-	       (format org-e-latex-active-timestamp-format
-		       (org-translate-time range-end))))
+       (let ((timestamps (org-split-string value "--")))
+	 (concat
+	  (format org-e-latex-active-timestamp-format (car timestamps))
+	  "--"
+	  (format org-e-latex-active-timestamp-format (cdr timestamps)))))
       (inactive (format org-e-latex-inactive-timestamp-format value))
       (inactive-range
-       (concat (format org-e-latex-inactive-timestamp-format value)
-	       "--"
-	       (format org-e-latex-inactive-timestamp-format
-		       (org-translate-time range-end))))
+       (let ((timestamps (org-split-string value "--")))
+	 (concat
+	  (format org-e-latex-inactive-timestamp-format (car timestamps))
+	  "--"
+	  (format org-e-latex-inactive-timestamp-format (cdr timestamps)))))
       (otherwise (format org-e-latex-diary-timestamp-format value)))))
 
 

+ 14 - 9
contrib/lisp/org-e-odt.el

@@ -3305,17 +3305,22 @@ information."
   "Transcode a TIMESTAMP object from Org to ODT.
 CONTENTS is nil.  INFO is a plist used as a communication
 channel."
-  (let ((timestamp-1 (org-element-property :value timestamp))
-	(timestamp-2 (org-element-property :range-end timestamp)))
+  (let ((value (org-translate-time
+		(org-element-property :raw-value timestamp))))
     (format "<text:span text:style-name=\"%s\">%s</text:span>"
 	    "OrgTimestampWrapper"
-	    (concat
-	     (format "<text:span text:style-name=\"%s\">%s</text:span>"
-		     "OrgTimestamp" (org-translate-time timestamp-1))
-	     (and timestamp-2
-		  "&#x2013;"
-		  (format "<text:span text:style-name=\"%s\">%s</text:span>"
-			  "OrgTimestamp" (org-translate-time timestamp-2)))))))
+	    (if (not (memq (org-element-property :type timestamp)
+			   '(active-range inactive-range)))
+		value
+	      (let ((timestamps (org-split-string value "--")))
+		(concat
+		 (format "<text:span text:style-name=\"%s\">%s</text:span>"
+			 "OrgTimestamp"
+			 (car timestamps))
+		 "&#x2013;"
+		 (format "<text:span text:style-name=\"%s\">%s</text:span>"
+			 "OrgTimestamp"
+			 (cdr timestamps))))))))
 
 
 ;;;; Underline

+ 8 - 7
contrib/lisp/org-e-texinfo.el

@@ -1570,13 +1570,14 @@ information."
   "Transcode a TIMESTAMP object from Org to Texinfo.
 CONTENTS is nil.  INFO is a plist holding contextual
 information."
-  (let ((value (org-translate-time (org-element-property :value timestamp)))
-	(type (org-element-property :type timestamp)))
-    (cond ((memq type '(active active-range))
-	   (format org-e-texinfo-active-timestamp-format value))
-	  ((memq type '(inactive inactive-range))
-	   (format org-e-texinfo-inactive-timestamp-format value))
-	  (t (format org-e-texinfo-diary-timestamp-format value)))))
+  (let ((value (org-translate-time
+		(org-element-property :raw-value timestamp))))
+    (case (org-element-property :type timestamp)
+      ((active active-range)
+       (format org-e-texinfo-active-timestamp-format value))
+      ((inactive inactive-range)
+       (format org-e-texinfo-inactive-timestamp-format value))
+      (t (format org-e-texinfo-diary-timestamp-format value)))))
 
 ;;; Verbatim