On 2008-12-28 at 15:33, Wolfgang Schuster wrote:
Am 27.12.2008 um 12:20 schrieb Tad Ashlock:
I'm trying to create a ConTeXt macro (mkiv) that will manipulate the macro argument's text with Lua and then feed it back into ConTeXt with tex.print(). My approach worked correctly until I called the macro with \starttabulate ... \stoptabulate in the macro's argument. So I started reducing the problem down to a minimum example which surprisingly turned out to have nothing to do with the manipulations I was performing. [snip]
\def\testmacro {\bgroup \catcode`\\=12 \dotestmacro}
\def\dotestmacro#1 {\ctxlua{d='\luaescapestring{#1}'}% \egroup}
\starttext
\testmacro{\starttabulate \NC text \NC text \NC\NR \stoptabulate}
%\ctxlua{tex.sprint(d)}
\stoptext
Wolfgang
Thank you Wolfgang! That's certainly a step in the right direction. But what I (and others?) really need is a way of passing any chunk of ConTeXt code into Lua. When I changed '\starttabulate' to '\starttabulate[|l|p|]' in your solution above, it broke. Thanks again, Tad