all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* New exporter: no custom timestamps
@ 2012-09-17 13:49 Giovanni Ridolfi
  2012-09-17 18:49 ` Jambunathan K
  0 siblings, 1 reply; 8+ messages in thread
From: Giovanni Ridolfi @ 2012-09-17 13:49 UTC (permalink / raw)
  To: Orgmode; +Cc: n.goaziou@gmail.com

Hello everybody,

I am not able to export with custiom timestamps with the new exporter. 

file:
---------------------------
* [2012-09-17 lun]
** [2013-04-28 dom] sunday
* COMMENT s
# Local Variables:
# org-display-custom-times: t
# org-time-stamp-custom-formats: ("<%d/%m/%Y %A>" . "<%d/%m/%Y %A %H:%M>")
# End:
----------------------
If I open the file the local variables are set. I toggle the timestamp format 

C-c C-x C-t and C-c C-e H exports to HTML with my custom timestamp in
the headline:

<h2 id="sec-1"><span class="section-number-2">1</span> <span class="timestamp-wrapper"> <span class="timestamp">17/09/2012 lunedì</span></span></h2>

Whereas with the new exporter

M-x org-export-dispatch h H

I get the ISO format:
<h2 id="sec-1"><span class="section-number-2">1</span> <span class="timestamp-wrapper"><span class="timestamp">2012-09-17 lun</span></span></h2>

cheers,
Giovanni


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: New exporter: no custom timestamps
  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
  0 siblings, 1 reply; 8+ messages in thread
From: Jambunathan K @ 2012-09-17 18:49 UTC (permalink / raw)
  To: Giovanni Ridolfi; +Cc: n.goaziou@gmail.com, Orgmode


> Hello everybody,
>
> I am not able to export with custiom timestamps with the new
> exporter. 

`org-translate-time' expects "<>" and "[]" to be passed to it.

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

    ,----
    | *** Welcome to IELM ***  Type (describe-mode) for help.
    | ELISP> org-display-custom-times
    | t
    | ELISP> org-time-stamp-custom-formats
    | ("<%d/%m/%Y %A>" . "<%d/%m/%Y %A %H:%M>")
    | 
    | ELISP> (setq T '(timestamp
    | 	  (:type inactive :value "2012-09-17 lun" :range-end nil)))
    | (timestamp
    |  (:type inactive :value "2012-09-17 lun" :range-end nil))
    | 
    | ELISP> (org-translate-time (org-element-property :value T))
    | "2012-09-17 lun"
    | ELISP> (org-translate-time (format "[%s]" (org-element-property :value T)))
    | "[17/09/2012 Monday]"
    | ELISP> 
    `----

> file:
> ---------------------------
> * [2012-09-17 lun]
> ** [2013-04-28 dom] sunday
> * COMMENT s
> # Local Variables:
> # org-display-custom-times: t
> # org-time-stamp-custom-formats: ("<%d/%m/%Y %A>" . "<%d/%m/%Y %A %H:%M>")
> # End:
> ----------------------

Use #+BIND:

> If I open the file the local variables are set. I toggle the timestamp format 
>
> C-c C-x C-t and C-c C-e H exports to HTML with my custom timestamp in
> the headline:
>
> <h2 id="sec-1"><span class="section-number-2">1</span> <span
> class="timestamp-wrapper"> <span class="timestamp">17/09/2012
> lunedì</span></span></h2>
>
> Whereas with the new exporter
>
> M-x org-export-dispatch h H
>
> I get the ISO format:
> <h2 id="sec-1"><span class="section-number-2">1</span> <span
> class="timestamp-wrapper"><span class="timestamp">2012-09-17
> lun</span></span></h2>
>
> cheers,
> Giovanni
>
>
>

-- 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: New exporter: no custom timestamps
  2012-09-17 18:49 ` Jambunathan K
@ 2012-09-18 11:15   ` Bastien
  2012-09-19 20:28     ` Nicolas Goaziou
  2012-09-22 16:44     ` Bastien
  0 siblings, 2 replies; 8+ messages in thread
From: Bastien @ 2012-09-18 11:15 UTC (permalink / raw)
  To: Jambunathan K; +Cc: Orgmode, n.goaziou@gmail.com

[-- 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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: New exporter: no custom timestamps
  2012-09-18 11:15   ` Bastien
@ 2012-09-19 20:28     ` Nicolas Goaziou
  2012-09-22 16:40       ` Bastien
  2012-10-28 15:44       ` Nicolas Goaziou
  2012-09-22 16:44     ` Bastien
  1 sibling, 2 replies; 8+ messages in thread
From: Nicolas Goaziou @ 2012-09-19 20:28 UTC (permalink / raw)
  To: Bastien; +Cc: Orgmode, Jambunathan K

Hello,

Bastien <bzg@altern.org> writes:

> 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) 

I tend to think that :raw-value would be a good option. Timestamps
properties could be enriched. Besides common properties
(:begin, :end, :post-blank) timestamps objects may accept :

  - :type
  - :year-start
  - :year-end
  - :month-start
  - :month-end
  - :day-start
  - :day-end
  - :hour-start
  - :hour-end
  - :minute-start
  - :minute-end
  - :repeater-type (a symbol among: `cumulative', 'catch-up', 'restart'
    corresponding to, respectively "+", "++" ".+" repeater marks)
  - :repeater-value
  - :raw-value

:*-end properties would be the same as :*-start properties when
timestamp isn't a range. Both would be nil (along with :repeater-*) when
type is `diary'.

By default back-ends would use :raw-value and `org-translate-time'.

:range-end property would be removed.

What do you think?


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: New exporter: no custom timestamps
  2012-09-19 20:28     ` Nicolas Goaziou
@ 2012-09-22 16:40       ` Bastien
  2012-10-28 15:44       ` Nicolas Goaziou
  1 sibling, 0 replies; 8+ messages in thread
From: Bastien @ 2012-09-22 16:40 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Orgmode, Jambunathan K

Hi Nicolas,

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> What do you think?

I think it would be great!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: New exporter: no custom timestamps
  2012-09-18 11:15   ` Bastien
  2012-09-19 20:28     ` Nicolas Goaziou
@ 2012-09-22 16:44     ` Bastien
  1 sibling, 0 replies; 8+ messages in thread
From: Bastien @ 2012-09-22 16:44 UTC (permalink / raw)
  To: Jambunathan K; +Cc: n.goaziou@gmail.com, Orgmode

Hi Jambunathan,

Bastien <bzg@altern.org> writes:

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

I have now applied the patch.  

Feel free to amend/edit/revert it if you think it is not good.

Thanks Giovanni for reporting this.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: New exporter: no custom timestamps
  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
  1 sibling, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2012-10-28 15:44 UTC (permalink / raw)
  To: Bastien; +Cc: Orgmode, Jambunathan K

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> I tend to think that :raw-value would be a good option. Timestamps
> properties could be enriched. Besides common properties
> (:begin, :end, :post-blank) timestamps objects may accept :
>
>   - :type
>   - :year-start
>   - :year-end
>   - :month-start
>   - :month-end
>   - :day-start
>   - :day-end
>   - :hour-start
>   - :hour-end
>   - :minute-start
>   - :minute-end
>   - :repeater-type (a symbol among: `cumulative', 'catch-up', 'restart'
>     corresponding to, respectively "+", "++" ".+" repeater marks)
>   - :repeater-value
>   - :raw-value
>
> :*-end properties would be the same as :*-start properties when
> timestamp isn't a range. Both would be nil (along with :repeater-*) when
> type is `diary'.
>
> By default back-ends would use :raw-value and `org-translate-time'.
>
> :range-end property would be removed.

Done. I've also added :repeater-unit for good measure.

Regards,

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: New exporter: no custom timestamps
  2012-10-28 15:44       ` Nicolas Goaziou
@ 2012-10-29  5:39         ` Bastien
  0 siblings, 0 replies; 8+ messages in thread
From: Bastien @ 2012-10-29  5:39 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Orgmode, Jambunathan K

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Done. I've also added :repeater-unit for good measure.

Great, thanks!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-10-29  6:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.