emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] org table with datestamp convert to csv and then xlsx or ods: pr


From: Uwe Brauer
Subject: Re: [O] org table with datestamp convert to csv and then xlsx or ods: problem
Date: Mon, 08 Jan 2018 15:04:29 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

   > Hello,
   > Uwe Brauer <address@hidden> writes:


   > None. The export to CSV looks correct and complete. Conversion to CSV
   > does not pretend converting anything else, in particular timestamps, to
   > another format.

Ok,

Now how could that be achieved? I seem not the only one missing that a
feature.
https://lists.gnu.org/archive/html/emacs-orgmode/2016-11/msg00398.html

So I googled and 
I tried

https://stackoverflow.com/questions/23297422/org-mode-timestamp-format-when-exported

Like
(defun org-export-filter-timestamp-remove-brackets (timestamp backend info)
  "removes relevant brackets from a timestamp"
  (cond
   ((org-export-derived-backend-p backend 'latex)
    (replace-regexp-in-string "[<>]\\|[][]" "" timestamp))
   ((org-export-derived-backend-p backend 'orgtbl-to-csv)
    (replace-regexp-in-string "[<>]\\|[][]" "" timestamp))
   ((org-export-derived-backend-p backend 'ascii)
    (replace-regexp-in-string "[<>]\\|[][]" "" timestamp))
   ((org-export-derived-backend-p backend 'html)
    (replace-regexp-in-string "&[lg]t;\\|[][]" "" timestamp))))

(eval-after-load 'ox '(add-to-list
                       'org-export-filter-timestamp-functions
                       'org-export-filter-timestamp-remove-brackets))


(defun org-ascii-timestamp (timestamp _contents info)
  (format-time-string
   "%d.%m.%y"
   (org-read-date nil t (org-timestamp-translate timestamp))))


(add-to-list 'org-export-filter-timestamp-functions
             #'endless/filter-timestamp)

(defun endless/filter-timestamp (trans back _comm)
  "Remove <> around time-stamps."
  (pcase back
    ((or `jekyll `html)
     (replace-regexp-in-string "&[lg]t;" "" trans))
    (`latex
     (replace-regexp-in-string "[<>]" "" trans))
    (`ascii
     (replace-regexp-in-string "[<>]" "" trans))
    (`csv
     (replace-regexp-in-string "[<>]" "" trans))))

But nothing helped.

Thanks

Uwe Brauer 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]