emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@altern.org>
To: Jambunathan K <kjambunathan@gmail.com>
Cc: Orgmode <emacs-orgmode@gnu.org>,
	"n.goaziou@gmail.com" <n.goaziou@gmail.com>
Subject: Re: New exporter: no custom timestamps
Date: Tue, 18 Sep 2012 13:15:32 +0200	[thread overview]
Message-ID: <87r4pz4m5n.fsf@bzg.ath.cx> (raw)
In-Reply-To: <877grs32nl.fsf@gmail.com> (Jambunathan K.'s message of "Tue, 18 Sep 2012 00:19:50 +0530")

[-- Attachment #1: Type: text/plain, Size: 436 bytes --]

Hi Jambunathan,

Jambunathan K <kjambunathan@gmail.com> writes:

> I am not sure whether (all) the exporters should be changed or just the
> API needs to be fixed.

I suggest to fix this in org-e-html.el with the attached patch.

There is another option: to set :raw-value for time-stamps, but
this feels a bit clumsy, especially when there is a :range-end.

  (org-element-property :raw-value TIMESTAMP) 

Let me know what you think.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-e-html.el.patch --]
[-- Type: text/x-patch, Size: 981 bytes --]

diff --git a/contrib/lisp/org-e-html.el b/contrib/lisp/org-e-html.el
index f3daa17..c3d1bf2 100644
--- a/contrib/lisp/org-e-html.el
+++ b/contrib/lisp/org-e-html.el
@@ -2857,11 +2857,12 @@ information."
   "Transcode a TIMESTAMP object from Org to HTML.
 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* ((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)))
     (format "<span class=\"timestamp-wrapper\"><span class=\"timestamp\">%s</span></span>"
 	    (if (not range-end) value
-	      (concat value "&ndash;" (org-translate-time range-end))))))
+	      (concat value "&ndash;" (org-translate-time (format f range-end)))))))
 
 
 ;;;; Underline

[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
 Bastien

  reply	other threads:[~2012-09-18 11:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-17 13:49 New exporter: no custom timestamps Giovanni Ridolfi
2012-09-17 18:49 ` Jambunathan K
2012-09-18 11:15   ` Bastien [this message]
2012-09-19 20:28     ` Nicolas Goaziou
2012-09-22 16:40       ` Bastien
2012-10-28 15:44       ` Nicolas Goaziou
2012-10-29  5:39         ` Bastien
2012-09-22 16:44     ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r4pz4m5n.fsf@bzg.ath.cx \
    --to=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=kjambunathan@gmail.com \
    --cc=n.goaziou@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).