From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/110621 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Fabrice Couvreur Newsgroups: gmane.comp.tex.context Subject: Re: Lua code and table Date: Thu, 18 Feb 2021 16:14:46 +0100 Message-ID: References: <98B049CA-8C85-4953-9E2D-1A4D6732BDBC@scorecrow.com> <441d5e40-2817-db15-5b43-a47535c25860@xs4all.nl> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5642717180645739250==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17036"; mail-complaints-to="usenet@ciao.gmane.io" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Feb 18 16:20:19 2021 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lCl6I-0004Is-B8 for gctc-ntg-context-518@m.gmane-mx.org; Thu, 18 Feb 2021 16:20:18 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id C96FB280BA2; Thu, 18 Feb 2021 16:19:50 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sl9G1aEhsGgF; Thu, 18 Feb 2021 16:19:49 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 5A28A280BA3; Thu, 18 Feb 2021 16:19:49 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 75197280BA3 for ; Thu, 18 Feb 2021 16:19:48 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LRIHoL2LoGf6 for ; Thu, 18 Feb 2021 16:19:47 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.210.52; helo=mail-ot1-f52.google.com; envelope-from=fabrice1.couvreur@gmail.com; receiver= Original-Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 203F9280BA2 for ; Thu, 18 Feb 2021 16:19:46 +0100 (CET) Original-Received: by mail-ot1-f52.google.com with SMTP id 80so2174175oty.2 for ; Thu, 18 Feb 2021 07:19:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=XnRF3IYkkQ0Q2t+dfMl7pnf8gX6kK+MDeyeaC9jRNrE=; b=nhEOzozSutqR4T8Vl9gwySxTaJI3EQF5y0c7A7T2kUtckkrjE3XEjsJxj33bIm+qqS BQdVq2H0ogrp12Vww9vvnXg28NVZTQfU3Xk0FPLUvNMFh/m3Jrc6O2hILZb6Rvp31X4H oYo2S9XrMIm+2EPLc+of6FRU8jKNPlSVUH/48vGmyKBvQPq9dt/XH9NjB4iaKCxvIKBw wI6mLG9EVaG2asxqu6FKVSi3WsC2Wjst++Z9WweVxnwePR6QMxkK+ZsjONttpS5MZrez XuvkCkSzF/mmKy5Et588aHU5jxLlqez9mEO3e6O+C20ZX5nd0o6zvwu8HLOv/f6jSJ+a Heug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=XnRF3IYkkQ0Q2t+dfMl7pnf8gX6kK+MDeyeaC9jRNrE=; b=MpqTWXPCZ89bGbOkPvRLt48T0xqFcBH4WtACt4A3Xwy4wO9Sqf3NnHo0LYuMd52+zP SWXbVsW/7LOR6z4J58HaXTvqhapgmFUC1TO9iocinbyRKYgnFEmSQtU1LphrKhRjqvsT jAdG4wZuYdMXkRjdsfdtHuntj51TE5veOLI3jomgp1IgCU9kIOkC0bfYCVZpWwxzqJQQ 3mgqF0fwy3dGhD2UiMyamlPJwHSCvzm7339DvrQIZbPzAgvS/cKcOSH10wNXKCI4OrDg aNdYtSlmLuEgJElF6ZQ+ZKm1yrqQAn4LR2SXjteC8ma4ijcG/By1haTS19yqReuQqqEL tKDQ== X-Gm-Message-State: AOAM532fAm35rpqzMl45hBUpDUUf4qqO4zEyIDYcg9BgsRR4yA9lPJFY BMkTlenp1Koys37x3+YOFoey7EnuOLmWkhU1DepFVAo//jM= X-Google-Smtp-Source: ABdhPJz5xPNBsIyv78RhsQnZm+JOEMfUsaR1IsZAvdKls2gwRLxyeWVlltenfTYp/EiP7xLjfLzJaR0zOqrCBIuKjZ4= X-Received: by 2002:a9d:1717:: with SMTP id i23mr3316144ota.179.1613661585038; Thu, 18 Feb 2021 07:19:45 -0800 (PST) In-Reply-To: <441d5e40-2817-db15-5b43-a47535c25860@xs4all.nl> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:110621 Archived-At: --===============5642717180645739250== Content-Type: multipart/alternative; boundary="000000000000905eca05bb9ddddd" --000000000000905eca05bb9ddddd Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi all, Thanks to you, I'm not at your level with Lua, but I'm learning thanks to you Hans, I compiled your code and I get an error message : lua error > lua error on line 50 in file ./table_1.tex: token call, syntax: [ctxlua]:11: unexpected symbol near '=3D' 13 \startluacode 14 function document.MyTable(specification) 15 16 local pattern =3D specification.pattern 17 local action =3D specification.action 18 local conversion =3D specification.conversion or "Character= s" 19 20 local n =3D #pattern 21 22 -- context.startxtable { align =3D "middle,lohi", width =3D "0.8cm", 23 >> offset =3D "0.8ex", bodyfont =3D "9pt", framecolor =3D "cyan" } 24 context.startxtable { "MyTable" } 25 context.startxrow() 26 context.startxcell { frame =3D "off" } 27 context() 28 context.stopxcell() 29 for i=3D1,n do 30 context.startxcell() 31 context.convertnumber(conversion,i) 32 context.stopxcell() 33 end mtx-context | fatal error: return code: 256 TeX Output exited abnormally with code 1 at Thu Feb 18 16:13:29 Thank you very much Fabrice Le jeu. 18 f=C3=A9vr. 2021 =C3=A0 10:06, Hans Hagen a = =C3=A9crit : > On 2/18/2021 12:22 AM, Bruce Horrocks wrote: > > >> On 17 Feb 2021, at 17:40, Fabrice Couvreur > wrote: > >> > >> Hi, The code works, but is it possible to make it shorter ? > OK, here is my take, based on earlier posts, bringing together some > 'technologies': > > (1) make a document function which isolatees the code > (2) then call it where needed > (3) use the built in conversion code > (4) use so called unique mp graphics (smaller files, faster run) > (5) use symbols to get the baseline right > (6) use a little abstraction in the table setup > > watch how we can pass a table instead of a string, so > > context.startxtable { align =3D "middle,lohi", width =3D "0.8cm", offset = =3D > "0.8ex", bodyfont =3D "9pt", framecolor =3D "cyan" } > > is ok, but anm abstraction is even better. Now, who will wikify it ... > > %%%%%%%%%%% code %%%%%%%%%%% > > \setupbodyfont[pagella] > > \starttext > > \definextable > [MyTable] > [align=3D{middle,lohi}, > width=3D0.8cm, > offset=3D0.8ex, > bodyfont=3D9pt, > framecolor=3Dcyan] > > \startluacode > function document.MyTable(specification) > > local pattern =3D specification.pattern > local action =3D specification.action > local conversion =3D specification.conversion or "Characters" > > local n =3D #pattern > > -- context.startxtable { align =3D "middle,lohi", width =3D "0.8cm"= , > offset =3D "0.8ex", bodyfont =3D "9pt", framecolor =3D "cyan" } > context.startxtable { "MyTable" } > context.startxrow() > context.startxcell { frame =3D "off" } > context() > context.stopxcell() > for i=3D1,n do > context.startxcell() > context.convertnumber(conversion,i) > context.stopxcell() > end > context.stopxrow() > for i=3D1,n do > context.startxrow() > context.startxcell() > context.convertnumber(conversion,i) > context.stopxcell() > for j=3D1,n do > context.startxcell { align =3D "middle" } > action(string.sub(pattern[i],j,j)) > context.stopxcell() > end > context.stopxrow() > end > context.stopxtable() > > end > \stopluacode > > \startuniqueMPgraphic{cross}{width,height,depth,color,line} > draw image ( > draw (\MPvar{depth},\MPvar{height}) -- (\MPvar{width},0) ; > draw (\MPvar{depth},0) -- (\MPvar{width},\MPvar{height}) ; > ) > withpen pencircle scaled \MPvar{line} > withcolor \MPvar{color} ; > \stopuniqueMPgraphic > > \definesymbol > [MyRedCross] > > > [\uniqueMPgraphic{cross}{width=3D1em,height=3D1ex,depth=3D.5ex,color=3Dre= d,line=3D.2ex}] > > \definesymbol > [MyGreenCross] > > > [\uniqueMPgraphic{cross}{width=3D1em,height=3D1ex,depth=3D.5ex,color=3Dgr= een,line=3D.2ex}] > > \startluacode > document.MyTable { > action =3D function(value) > context(value =3D=3D "X" and 1 or 0) > end, > conversion =3D "Characters", > pattern =3D { > ".XXX..XX", > "X...XXX.", > "X..X.XXX", > "X.X.X..X", > ".X.X.XX.", > ".XX.X...", > "XXX.X...", > "X.XX...." > } > } > \stopluacode > > \startluacode > document.MyTable { > action =3D function(value) > context(value =3D=3D "X" and 1 or 0) > end, > conversion =3D "Greek", > pattern =3D { > ".XXX..XX", > "X...XXX.", > "X..X.XXX", > "X.X.X..X", > } > } > \stopluacode > > \startluacode > document.MyTable { > action =3D function(value) > if value =3D=3D "X" then > context.symbol { "MyRedCross" } > end > end, > conversion =3D "Romannumerals", > pattern =3D { > ".XXX..XX", > "X...XXX.", > "X..X.XXX", > "X.X.X..X", > ".X.X.XX.", > ".XX.X...", > "XXX.X...", > "X.XX...." > } > } > \stopluacode > > \startluacode > document.MyTable { > action =3D function(value) > context.symbol { value =3D=3D "X" and "MyRedCross" or > "MyGreenCross" } > end, > conversion =3D "Romannumerals", > pattern =3D { > "X.X.X..X", > ".X.X.XX.", > ".XX.X...", > "XXX.X...", > "X.XX...." > } > } > \stopluacode > > \stoptext > > > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl > ----------------------------------------------------------------- > > _________________________________________________________________________= __________ > 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://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > > _________________________________________________________________________= __________ > --000000000000905eca05bb9ddddd Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi all,= Thanks to you= , I'm not at your level with Lua, but I'm learning thanks to you
Ha= ns, I compiled your code and I get an error message :

<= span>lua error =C2=A0 =C2=A0 =C2=A0 > lua error on line 50 in file ./tab= le_1.tex:

token call, syntax: [ctxlua]:11: unexpected symbol near &#= 39;=3D'

13 =C2=A0 =C2=A0 \startluacode
14 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0function document.MyTable(specification)
15 =C2=A0 =C2= =A0
16 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0local pattern = =C2=A0 =C2=A0=3D specification.pattern
17 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0local action =C2=A0 =C2=A0 =3D specification.action
= 18 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0local conversion =3D spe= cification.conversion or "Characters"
19 =C2=A0 =C2=A0
20 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0local n =3D #pattern
21 = =C2=A0 =C2=A0
22 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-- =C2=A0context.sta= rtxtable { align =3D "middle,lohi", width =3D "0.8cm",<= br>23 >> =C2=A0offset =3D "0.8ex", bodyfont =3D "9pt&q= uot;, framecolor =3D "cyan" }
24 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0context.startxtable { "MyTable" }
25 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0context.startxro= w()
26 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0context.startxcell { frame =3D "off" }
27 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0context()
28 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0context.stopxcell()
29 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for i=3D1,n do
30= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0context.startxcell()
31 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0co= ntext.convertnumber(conversion,i)
32 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0context.stopxcell()<= br>33 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0end

mtx-context =C2=A0 =C2=A0 | fatal error: return code: 256=

TeX Output exited abnormally with code 1 at Thu Feb 18 16:13:29
=


=
Thank you ve= ry much
<= /span>
Fabrice

Le=C2=A0jeu. 18 f=C3=A9vr. 2021 =C3=A0=C2=A010:06, Ha= ns Hagen <j.hagen@xs4all.nl>= a =C3=A9crit=C2=A0:
On 2/18/2021 12:22 AM, Bruce Horrocks wrote:

>> On 17 Feb 2021, at 17:40, Fabrice Couvreur <fabrice1.couvreur@gmail.com> wrote:
>>
>> Hi, The code works, but is it possible to make it shorter ?
OK, here is my take, based on earlier posts, bringing together some
'technologies':

(1) make a document function which isolatees the code
(2) then call it where needed
(3) use the built in conversion code
(4) use so called unique mp graphics (smaller files, faster run)
(5) use symbols to get the baseline right
(6) use a little abstraction in the table setup

watch how we can pass a table instead of a string, so

context.startxtable { align =3D "middle,lohi", width =3D "0.= 8cm", offset =3D
"0.8ex", bodyfont =3D "9pt", framecolor =3D "cyan&= quot; }

is ok, but anm abstraction is even better. Now, who will wikify it ...

%%%%%%%%%%% code %%%%%%%%%%%

\setupbodyfont[pagella]

\starttext

\definextable
=C2=A0 =C2=A0[MyTable]
=C2=A0 =C2=A0[align=3D{middle,lohi},
=C2=A0 =C2=A0 width=3D0.8cm,
=C2=A0 =C2=A0 offset=3D0.8ex,
=C2=A0 =C2=A0 bodyfont=3D9pt,
=C2=A0 =C2=A0 framecolor=3Dcyan]

\startluacode
=C2=A0 =C2=A0 =C2=A0function document.MyTable(specification)

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0local pattern=C2=A0 =C2=A0 =3D specificat= ion.pattern
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0local action=C2=A0 =C2=A0 =C2=A0=3D speci= fication.action
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0local conversion =3D specification.conver= sion or "Characters"

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0local n =3D #pattern

=C2=A0 =C2=A0 =C2=A0--=C2=A0 context.startxtable { align =3D "middle,l= ohi", width =3D "0.8cm",
offset =3D "0.8ex", bodyfont =3D "9pt", framecolor =3D = "cyan" }
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0context.startxtable { "MyTable"= }
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0context.startxrow()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0context.start= xcell { frame =3D "off" }
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0context()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0context.stopx= cell()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for i=3D1,n d= o
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0context.startxcell()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0context.convertnumber(conversion,i)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0context.stopxcell()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0end
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0context.stopxrow()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for i=3D1,n do
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0context.start= xrow()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0context.startxcell()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0context.convertnumber(conversion,i)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0context.stopxcell()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for j=3D1,n d= o
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0context.startxcell { align =3D "middle" }
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0action(string.sub(pattern[i],j,j))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0context.stopxcell()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0end
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0context.stopx= row()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0end
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0context.stopxtable()

=C2=A0 =C2=A0 =C2=A0end
\stopluacode

\startuniqueMPgraphic{cross}{width,height,depth,color,line}
=C2=A0 =C2=A0 =C2=A0draw image (
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0draw (\MPvar{depth},\MPvar{height}) -- (\= MPvar{width},0) ;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0draw (\MPvar{depth},0) -- (\MPvar{width},= \MPvar{height}) ;
=C2=A0 =C2=A0 =C2=A0)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0withpen pencircle scaled \MPvar{line}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0withcolor \MPvar{color} ;
\stopuniqueMPgraphic

\definesymbol
=C2=A0 =C2=A0[MyRedCross]

[\uniqueMPgraphic{cross}{width=3D1em,height=3D1ex,depth=3D.5ex,color=3Dred,= line=3D.2ex}]

\definesymbol
=C2=A0 =C2=A0[MyGreenCross]

[\uniqueMPgraphic{cross}{width=3D1em,height=3D1ex,depth=3D.5ex,color=3Dgree= n,line=3D.2ex}]

\startluacode
=C2=A0 =C2=A0 =C2=A0document.MyTable {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0action =3D function(value)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0context(value =3D=3D "= X" and 1 or 0)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0end,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0conversion =3D "Characters", =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pattern =3D {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0".XXX..XX",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"X...XXX.",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"X..X.XXX",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"X.X.X..X",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0".X.X.XX.",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0".XX.X...",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"XXX.X...",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"X.XX...."
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0}
\stopluacode

\startluacode
=C2=A0 =C2=A0 =C2=A0document.MyTable {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0action =3D function(value)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0context(value =3D=3D "= X" and 1 or 0)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0end,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0conversion =3D "Greek",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pattern =3D {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0".XXX..XX",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"X...XXX.",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"X..X.XXX",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"X.X.X..X",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0}
\stopluacode

\startluacode
=C2=A0 =C2=A0 =C2=A0document.MyTable {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0action =3D function(value)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if value =3D=3D "X&quo= t; then
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0context.symbo= l { "MyRedCross" }
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0end
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0end,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0conversion =3D "Romannumerals",=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pattern =3D {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0".XXX..XX",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"X...XXX.",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"X..X.XXX",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"X.X.X..X",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0".X.X.XX.",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0".XX.X...",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"XXX.X...",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"X.XX...."
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0}
\stopluacode

\startluacode
=C2=A0 =C2=A0 =C2=A0document.MyTable {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0action =3D function(value)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0context.symbol { value =3D= =3D "X" and "MyRedCross"=C2=A0 or
"MyGreenCross" }
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0end,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0conversion =3D "Romannumerals",=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pattern =3D {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"X.X.X..X",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0".X.X.XX.",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0".XX.X...",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"XXX.X...",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"X.XX...."
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0}
\stopluacode

\stoptext


-----------------------------------------------------------------
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0Hans Hagen | PRAGMA ADE
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Ridderstraat 27 | 80= 61 GH Hasselt | The Netherlands
=C2=A0 =C2=A0 =C2=A0 =C2=A0 tel: 038 477 53 69 |
www.pragma-ade.nl | www.= pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________= ________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-cont= ext@ntg.nl / http://www.ntg.nl/mailman/listinfo/nt= g-context
webpage=C2=A0 : http://www.pragma-ade.nl / http://context.aanhet.net=
archive=C2=A0 : https://bitbucket.org/phg/context-m= irror/commits/
wiki=C2=A0 =C2=A0 =C2=A0: http://contextgarden.net
___________________________________________________________________________= ________
--000000000000905eca05bb9ddddd-- --===============5642717180645739250== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============5642717180645739250==--