Correcting myself,

Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:

> I suggest
>
>   (cons "date"
>         (format
>          "(eval (if (org-string-nw-p \"$1\") %s %S))"
>          "(org-export-get-date info \"$1\")"
>          (or (org-element-interpret-data (plist-get info :date))
>              "")))

Please scratch that, reference to "info" will prevent us to move to use
lexical binding later. Something like this is required instead:

  (cons "date"
        (let* ((date (plist-get info :date))
               (value (or (org-element-interpret-data date) "")))
          (if (and (null (cdr date))
                   (eq (org-element-type (car date)) 'timestamp))
              (format "(eval (if (org-string-nw-p \"$1\") %s %S))"
                      (format "(org-timestamp-format '%S \"$1\")"
                              ;; Remove parent to avoid
                              ;; read error.
                              `(timestamp
                                ,(org-combine-plists
                                  (nth 1 (car date))
                                  '(:parent nil))))
                      value)
            value)))

I think the later part could use an `org-element-copy' function (to be
implemented).

Reply via email to