ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@googlemail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Problem Passing \starttabulate into Lua
Date: Tue, 30 Dec 2008 10:06:40 +0100	[thread overview]
Message-ID: <999ECAF9-30AE-4EA6-B21E-FF629FD09EA0@gmail.com> (raw)
In-Reply-To: <F1163D1E-F1AD-4E63-BCBE-F54E295C4957@gmail.com>


Am 29.12.2008 um 14:28 schrieb Wolfgang Schuster:

>> When I changed '\starttabulate' to '\starttabulate[|l|p|]' in your  
>> solution above, it broke.
>
> Try to escape the |, it's a active character in ConTeXt but this
> could work (untested):
>
> \def\testmacro
>  {\bgroup
>   \catcode`\\=12
>   \catcode`\|=12
>   \dotestmacro}

And now with a catcode table.

% redefined version of \startcatcodetable

\long\def\startcatcodetable#1#2\stopcatcodetable
   {\bgroup
    %\catcodetable\scratchcatcodetable
    \the\setdefaultcatcodes
    #2%
    \savecatcodetable#1\relax
    \egroup}

% the new catcode table

\newcatcodetable \testcatcodes

\startcatcodetable \testcatcodes
     \catcode`\\ = 12
     \catcode`\| = 12
\stopcatcodetable

\def\testmacro
   {\bgroup
    \setcatcodetable\testcatcodes
    \dotestmacro}

\def\dotestmacro#1%
   {\ctxlua{d='\luaescapestring{#1}'}
    \egroup}

\starttext

\testmacro{\starttabulate[|l|p|] \NC knuth \NC \input knuth \NC\NR  
\stoptabulate}

\ctxlua{tex.sprint(d)}

\stoptext

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


  reply	other threads:[~2008-12-30  9:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-27 11:20 Tad Ashlock
2008-12-28 22:33 ` Wolfgang Schuster
2008-12-29 12:56   ` Ashlock, Tad A
2008-12-29 13:14     ` luigi scarso
2008-12-29 13:28     ` Wolfgang Schuster
2008-12-30  9:06       ` Wolfgang Schuster [this message]
2009-01-01 11:00 ` Wolfgang Schuster

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=999ECAF9-30AE-4EA6-B21E-FF629FD09EA0@gmail.com \
    --to=schuster.wolfgang@googlemail.com \
    --cc=ntg-context@ntg.nl \
    /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.
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 NNTP newsgroup(s).