emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@altern.org>
To: Nathan Trapuzzano <nbtrap@nbtrap.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Bug: Table export to [tc]sv doesn't convert \vert [7.8.11]
Date: Fri, 28 Dec 2012 18:26:26 +0100	[thread overview]
Message-ID: <87sj6qkrd7.fsf@bzg.ath.cx> (raw)
In-Reply-To: <20121225233220.03a42d24@nbtrap.com> (Nathan Trapuzzano's message of "Tue, 25 Dec 2012 23:32:20 -0500")

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

Hi Nathan,

Nathan Trapuzzano <nbtrap@nbtrap.com> writes:

> Converting \vert and \vert{} when exporting an Org table to csv or tsv does not
> properly convert them to the vertical bar. Instead, they are retained literally.

A hackish patch like this one fixes this, but it's not general enough.
Also, converting entities in tables is prone to false-positives, so
let's live with this limitation until we generalize the way entities
are handled.

Best,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-convert-csv-entities.patch --]
[-- Type: text/x-patch, Size: 740 bytes --]

diff --git a/lisp/org.el b/lisp/org.el
index 04bb2e9..a366f95 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -20030,8 +20030,12 @@ With prefix arg UNCOMPILED, load the uncompiled versions."
 (defun org-quote-csv-field (s)
   "Quote field for inclusion in CSV material."
   (if (string-match "[\",]" s)
-      (concat "\"" (mapconcat 'identity (split-string s "\"") "\"\"") "\"")
-    s))
+      (setq s (concat "\"" (mapconcat 'identity (split-string s "\"") "\"\"") "\"")))
+  (if (string-match "\\\\\\([a-zA-Z]+[0-9]*\\)\\({}\\)?" s)
+      (setq s (replace-match
+	       (org-entity-get-representation
+		(match-string 1 s) 'ascii) t t s 0)))
+  s)
 
 (defun org-force-self-insert (N)
   "Needed to enforce self-insert under remapping."

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


-- 
 Bastien

  reply	other threads:[~2012-12-28 17:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-26  4:32 Bug: Table export to [tc]sv doesn't convert \vert [7.8.11] Nathan Trapuzzano
2012-12-28 17:26 ` Bastien [this message]
2012-12-30  1:25   ` Nathan Trapuzzano
2012-12-30  9:00     ` Bastien
2012-12-31  4:01       ` Nathan Trapuzzano
2012-12-31  9:30         ` Bastien
2013-01-02 21:50           ` Nathan Trapuzzano
2013-01-03  8:57             ` 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=87sj6qkrd7.fsf@bzg.ath.cx \
    --to=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=nbtrap@nbtrap.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).