emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [HOW] no way to escape vertical bar (pipe char) in tables?
@ 2011-02-24 11:59 Vladimir Alexiev
  2011-03-03 11:00 ` Bastien
  2011-03-07 15:47 ` Eric Schulte
  0 siblings, 2 replies; 6+ messages in thread
From: Vladimir Alexiev @ 2011-02-24 11:59 UTC (permalink / raw)
  To: emacs-orgmode

I want to manage some perl regexps in a table
then feed them to a code block (literate programming).
Unfortunately they include alternatives (|) 
and the table editor thinks this is a column break.

There's no way to escape this?

On a related thought: what is the best way to manage
leading/trailing spaces in a table cell?
I've been forced to use \x20 for this purpose...

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

* Re: [HOW] no way to escape vertical bar (pipe char) in tables?
  2011-02-24 11:59 [HOW] no way to escape vertical bar (pipe char) in tables? Vladimir Alexiev
@ 2011-03-03 11:00 ` Bastien
  2011-03-03 16:00   ` Camille persson
  2011-03-07  8:16   ` Vladimir Alexiev
  2011-03-07 15:47 ` Eric Schulte
  1 sibling, 2 replies; 6+ messages in thread
From: Bastien @ 2011-03-03 11:00 UTC (permalink / raw)
  To: Vladimir Alexiev; +Cc: emacs-orgmode

Hi Vladimir,

Vladimir Alexiev <vladimir@sirma.bg> writes:

> I want to manage some perl regexps in a table
> then feed them to a code block (literate programming).
> Unfortunately they include alternatives (|) 
> and the table editor thinks this is a column break.
>
> There's no way to escape this?

AFAIK, there is not.

> On a related thought: what is the best way to manage
> leading/trailing spaces in a table cell?
> I've been forced to use \x20 for this purpose...

This i don't understand -- you want to *keep* the spaces 
in the exported table?  

-- 
 Bastien

-- 
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Re: [HOW] no way to escape vertical bar (pipe char) in tables?
  2011-03-03 11:00 ` Bastien
@ 2011-03-03 16:00   ` Camille persson
  2011-03-07  8:16   ` Vladimir Alexiev
  1 sibling, 0 replies; 6+ messages in thread
From: Camille persson @ 2011-03-03 16:00 UTC (permalink / raw)
  To: Vladimir Alexiev, Bastien; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 926 bytes --]

Hi Vladimir and Bastien,

2011/3/3 Bastien <bzg@altern.org>

> Hi Vladimir,
>
> Vladimir Alexiev <vladimir@sirma.bg> writes:
>
> > I want to manage some perl regexps in a table
> > then feed them to a code block (literate programming).
> > Unfortunately they include alternatives (|)
> > and the table editor thinks this is a column break.
> >
> > There's no way to escape this?
>
> AFAIK, there is not.
>

Shouldn't your perl regexp be in a formula - ie. not directly in the table ?

Camille


>
> > On a related thought: what is the best way to manage
> > leading/trailing spaces in a table cell?
> > I've been forced to use \x20 for this purpose...
>
> This i don't understand -- you want to *keep* the spaces
> in the exported table?
>
> --
>  Bastien
>
> --
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>

[-- Attachment #1.2: Type: text/html, Size: 1767 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

-- 
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* RE: [HOW] no way to escape vertical bar (pipe char) in tables?
  2011-03-03 11:00 ` Bastien
  2011-03-03 16:00   ` Camille persson
@ 2011-03-07  8:16   ` Vladimir Alexiev
  2011-03-07  8:29     ` Bastien
  1 sibling, 1 reply; 6+ messages in thread
From: Vladimir Alexiev @ 2011-03-07  8:16 UTC (permalink / raw)
  To: emacs-orgmode

> > what is the best way to manage
> > leading/trailing spaces in a table cell?
> This i don't understand -- you want to *keep* the spaces
> in the exported table?

Not all spaces, but some spaces some of the time is needed.

The recent patch to org-babel-read by Erik Schulte makes this possible. See second sentence below:

If a value starts with one of ('` it is read as an emacs lisp sexp.
If it starts with " then it's read as a quoted string: start/end quotes are stripped, \" and \\ are unescaped
   (this is useful for embedding leading/trailing whitespace in strings).
If it looks like a number, it's read as a number.
Else it's read as a literal string, without any quotation or escaping.
(Please note that | in tables is always interpreted as column separator and currently there is no way to quote it)

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

* Re: RE: [HOW] no way to escape vertical bar (pipe char) in tables?
  2011-03-07  8:16   ` Vladimir Alexiev
@ 2011-03-07  8:29     ` Bastien
  0 siblings, 0 replies; 6+ messages in thread
From: Bastien @ 2011-03-07  8:29 UTC (permalink / raw)
  To: vladimir; +Cc: emacs-orgmode

"Vladimir Alexiev" <vladimir@sirma.bg> writes:

>> > what is the best way to manage
>> > leading/trailing spaces in a table cell?
>> This i don't understand -- you want to *keep* the spaces
>> in the exported table?
>
> Not all spaces, but some spaces some of the time is needed.
>
> The recent patch to org-babel-read by Erik Schulte makes this
> possible. 

Good, thanks for letting us know!

-- 
 Bastien

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

* Re: [HOW] no way to escape vertical bar (pipe char) in tables?
  2011-02-24 11:59 [HOW] no way to escape vertical bar (pipe char) in tables? Vladimir Alexiev
  2011-03-03 11:00 ` Bastien
@ 2011-03-07 15:47 ` Eric Schulte
  1 sibling, 0 replies; 6+ messages in thread
From: Eric Schulte @ 2011-03-07 15:47 UTC (permalink / raw)
  To: Vladimir Alexiev; +Cc: emacs-orgmode

Vladimir Alexiev <vladimir@sirma.bg> writes:

> I want to manage some perl regexps in a table
> then feed them to a code block (literate programming).
> Unfortunately they include alternatives (|) 
> and the table editor thinks this is a column break.
>
> There's no way to escape this?
>

Using a different character (namely ¦) the following should work

#+source: clean
#+begin_src emacs-lisp :var in=""
  (flet ((clean (in)
                (if (listp in)
                    (mapcar #'clean in)
                  (if (stringp in)
                      (replace-regexp-in-string "¦" "|" in)
                    in))))
    (clean in))
#+end_src

#+results: regexps
| first  | (a¦b) |
| second | (1¦2) |

#+begin_src perl :var a=clean(in=regexps)[0,1] :var b=clean(in=regexps)[1,1]
  $a; $b;
#+end_src

#+results:
: (1|2)

Best -- Eric

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

end of thread, other threads:[~2011-03-07 15:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-24 11:59 [HOW] no way to escape vertical bar (pipe char) in tables? Vladimir Alexiev
2011-03-03 11:00 ` Bastien
2011-03-03 16:00   ` Camille persson
2011-03-07  8:16   ` Vladimir Alexiev
2011-03-07  8:29     ` Bastien
2011-03-07 15:47 ` Eric Schulte

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