From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/46548 Path: news.gmane.org!not-for-mail From: Tad Ashlock Newsgroups: gmane.comp.tex.context Subject: Problem Passing \starttabulate into Lua Date: Sat, 27 Dec 2008 04:20:35 -0700 Message-ID: <49560F83.3080706@cyberdude.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1230450605 27366 80.91.229.12 (28 Dec 2008 07:50:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 28 Dec 2008 07:50:05 +0000 (UTC) To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Sun Dec 28 08:51:13 2008 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1LGqQY-0008DT-Kx for gctc-ntg-context-518@m.gmane.org; Sun, 28 Dec 2008 08:51:10 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id AB7151FBBA; Sun, 28 Dec 2008 08:49:54 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 21924-04-2; Sun, 28 Dec 2008 08:48:36 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 90A0C1FBA8; Sun, 28 Dec 2008 08:48:36 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 4336F1FBBD for ; Sat, 27 Dec 2008 12:21:42 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 10552-02-10 for ; Sat, 27 Dec 2008 12:20:52 +0100 (CET) Original-Received: from smtp1.us4.outblaze.com (smtp1.us4.outblaze.com [205.158.62.78]) by ronja.ntg.nl (Postfix) with SMTP id 0E8DC1FBD4 for ; Sat, 27 Dec 2008 12:20:50 +0100 (CET) Original-Received: (qmail 20109 invoked from network); 27 Dec 2008 11:20:48 -0000 Original-Received: from unknown (HELO ?127.0.0.1?) (taashlo:cyberdude.com?mail.com@97.119.176.48) by smtp1.us4.outblaze.com with SMTP; 27 Dec 2008 11:20:37 -0000 User-Agent: Thunderbird 2.0.0.18 (Windows/20081105) X-Antivirus: avast! (VPS 081226-0, 12/26/2008), Outbound message X-Antivirus-Status: Clean X-Virus-Scanned: amavisd-new at ntg.nl X-Mailman-Approved-At: Sun, 28 Dec 2008 08:48:35 +0100 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.11 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:46548 Archived-At: 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. Here is the working example (without \starttabulate): \long\def\testmacro#1{\directlua0{d='\luaescapestring{#1}'}} \starttext Hello, world! \testmacro{% testing} \stoptext Here is the broken example: \long\def\testmacro#1{\directlua0{d='\luaescapestring{#1}'}} \starttext Hello, world! \testmacro{% testing \starttabulate \NC 0 \NC testing tabulate. \NC \NR \stoptabulate} \stoptext Here's the output: ===================================== MtxRun | loading configuration for C:/context/tex/texmf/web2c from C:/context/tex/texmf-cache/luatex-cache/context/2fea56f92e5267d7cc9662e4d5f52e1e/trees/53ad5f8b88994bdd02baa17501789699 MtxRun | run 1: luatex --fmt="C:/context/tex/texmf-cache/luatex-cache/context/2fea56f92e5267d7cc9662e4d5f52e1e/formats/cont-en" --lua="C:/context/tex/texmf-cache/luatex-cache/context/2fea56f92e5267d7cc9662e4d5f52e1e/formats/cont-en.lua" "./test.tex" (test.tex ConTeXt ver: 2008.10.31 13:58 MKIV fmt: 2008.12.24 int: english/english language : language en is active system : cont-new loaded (C:/context/tex/texmf-context/tex/context/base/cont-new.tex systems : beware: some patches loaded from cont-new.tex (C:/context/tex/texmf-context/tex/context/base/cont-new.mkiv) (C:/context/tex/texmf-context/tex/context/base/cont-mtx.tex)) system : cont-fil loaded (C:/context/tex/texmf-context/tex/context/base/cont-fil.tex loading : Context File Synonyms ) system : cont-sys.rme loaded (C:/context/tex/texmf-context/tex/context/user/cont-sys.rme (C:/context/tex/texmf-context/tex/context/base/type-tmf.tex) (C:/context/tex/texmf-context/tex/context/base/type-siz.tex) (C:/context/tex/texmf-context/tex/context/base/type-otf.tex)) bodyfont : 12pt rm is loaded specials : pdftex loaded system : test.top loaded (test.top) (test.tuo) (test.tuo) systems : begin file test at line 2 ! Argument of \dodoubletestempty has an extra }. \par } \doifnextcharelse ...token =#1\def \!!stringa {#2} \def \!!stringb {#3}\futur... testing \starttabulate \NC 0 \NC testing tabulate. \NC \NR \stopt... \testmacro ...\directlua 0{d='\luaescapestring {#1 }'} l.8 \stoptabulate} ? ===================================== I've tried all sorts of variations on the above example including using \ctxlua, \startlua, \startluacode, etc. I tried using '[[...]]' and '[===[...]===]' instead of \luaescapestring. I tried \def with and without \long. I tried other \start* ... \stop* commands (different errors, but still broken). Plus many more variations. At this point I'm convinced that there's something fundamental that I'm not understanding. What is the general method for taking any chunk of ConTeXt code and passing it into Lua so that it can be written back out with tex.print()? Info: running on Windows XP, SP3 -- ConTeXt: 2008.10.31 -- LuaTeX, Version snapshot-0.31.2-2008121200, build 1659 (The older versions of ConTeXt and LuaTeX are necessary because of the problem the latest Windows versions are having. See the "Serious Bug?" thread.) Thank you, Tad Ashlock ___________________________________________________________________________________ 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 ___________________________________________________________________________________