From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/65091 Path: news.gmane.org!not-for-mail From: luigi scarso Newsgroups: gmane.comp.tex.context Subject: Re: handling key=value sets with lua Date: Sun, 9 Jan 2011 23:43:00 +0100 Message-ID: References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1693329814==" X-Trace: dough.gmane.org 1294613041 5204 80.91.229.12 (9 Jan 2011 22:44:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 9 Jan 2011 22:44:01 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Jan 09 23:43:57 2011 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Pc3zR-000778-3b for gctc-ntg-context-518@m.gmane.org; Sun, 09 Jan 2011 23:43:57 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id C3753CAA70; Sun, 9 Jan 2011 23:43:56 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id MX3LVY7Q9L0I; Sun, 9 Jan 2011 23:43:53 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id BAD09CAA51; Sun, 9 Jan 2011 23:43:52 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 2B9CACAA51 for ; Sun, 9 Jan 2011 23:43:52 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id hxZGOftjF0eZ for ; Sun, 9 Jan 2011 23:43:49 +0100 (CET) Original-Received: from filter1-ams.mf.surf.net (filter1-ams.mf.surf.net [192.87.102.69]) by balder.ntg.nl (Postfix) with ESMTP id C5F78CAA50 for ; Sun, 9 Jan 2011 23:43:49 +0100 (CET) Original-Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com [74.125.82.45]) by filter1-ams.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p09MhntT014186 for ; Sun, 9 Jan 2011 23:43:49 +0100 Original-Received: by wwb29 with SMTP id 29so19596478wwb.2 for ; Sun, 09 Jan 2011 14:43:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=TLzITcEubrEcnrVTCZ+0Ooi6PqaRJZe9MCpDkUbmHjg=; b=O10tJagO7csq8nnYdv/GBRR7ICGxbJ35Q8Pgi9ME8fhwOfbcsDxAkPTrTKixE4setD FkY69LmbY3DhOf5L8By5zaF0Z8elcFzwYgwxDWZpov6lLFB389iApYaWvNTCBj2wKyAe ijxwHYk7Wu0BDNuQzYW5VumMlJSbTUvfhhtaw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=CNlUNznPXNaSQJUptN5ed3YteNnj9j3sRmGgLC1er++yA6e3126spdbL6w9lKLBUHI Won69DjpswLz7nrzoNdeinNKoFbGoQyoEPPhkWwhtazM9y4CmZqESS8xvb/uiCHFerYg 5pUSZEBO4Ceghdj580emGMajWZYlJQ4Ja8byM= Original-Received: by 10.227.144.7 with SMTP id x7mr2031388wbu.115.1294612980139; Sun, 09 Jan 2011 14:43:00 -0800 (PST) Original-Received: by 10.227.131.87 with HTTP; Sun, 9 Jan 2011 14:43:00 -0800 (PST) In-Reply-To: X-Bayes-Prob: 0.5 (Score 0, tokens from: ) X-CanIt-Geo: ip=74.125.82.45; country=US; region=CA; city=Mountain View; postalcode=94043; latitude=37.4192; longitude=-122.0574; metrocode=807; areacode=650; http://maps.google.com/maps?q=37.4192,-122.0574&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 06DRyHNWd - e114d261595d - 20110109 X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.69 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 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 Xref: news.gmane.org gmane.comp.tex.context:65091 Archived-At: --===============1693329814== Content-Type: multipart/alternative; boundary=0016e65b645acd86530499719253 --0016e65b645acd86530499719253 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sun, Jan 9, 2011 at 11:13 PM, Philipp A. wrote: > hi list, > > skip to the many %%% if you just want to help me ;) > > i need to make a macro which consists of ten optional arguments. it > wouldn=E2=80=99t be too ugly to require to write the following to use it,= since it > outputs a 3=C3=973 matrix with an adjacent tenth item, but tex can=E2=80= =99t handle ten > arguments afaik. > > > syntax idea: > empty: > \bigcrafting% > {}{}{}% > {}{}{}{}% > {}{}{}% > > partly filled: > \bigcrafting% > {}{}{}% > {planks}{planks}{}{workbench}% > {planks}{planks}{}% > > how it should look: > [image: CraftingWorkbenchIO.png] > > ok, since using empty =E2=80=9Crequired=E2=80=9D arguments aren=E2=80=99t= elegent, either, i wanted > to get into key=3Dvalue sets, but ran into the next problem: > > i wanted to instead define bigcrafting to work like this: > \bigcrafting > [21=3Dplanks, 22=3Dplanks, > 31=3Dplanks, 32=3Dplanks] > [workbench] > > but \getparameterscan=E2=80=99t handle numerical values. > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > As Hans wrote it's possible, but I like the to use "row" for row, "col" f= or column and "c" for cell i.e \def\BigCrafting[#1]% {\getparameters[Ph][c11=3D{},c12=3D{},c13=3D{}, c21=3D{},c22=3D{},c23=3D{},c24=3D{}, c31=3D{},c32=3D{},c33=3D{},#1] \bTABLE \bTR\bTD\getvalue{Phc11}\eTD\bTD\getvalue{Phc12}\eTD\bTD\getvalue{Phc13}\eT= D\eTR \bTR\bTD\getvalue{Phc21}\eTD\bTD\getvalue{Phc22}\eTD\bTD\getvalue{Phc23}\eT= D\bTD\getvalue{Phc24}\eTD\eTR \bTR\bTD\getvalue{Phc31}\eTD\bTD\getvalue{Phc32}\eTD\bTD\getvalue{Phc33}\eT= D\eTR \eTABLE } \starttext \BigCrafting[c11=3DFOO,c33=3DGOO,c22=3DBOO,c24=3DZoo] \BigCrafting[c11=3DFOO,c24=3DGOO] \stoptext You can also use a better namespace \def\BigCrafting[#1]% \unprotect \getparameters[flying-sheep@web.de:][c11=3D{},c12=3D{},c13=3D{}, c21=3D{},c22=3D{},c23=3D{},c24=3D{}, c31=3D{},c32=3D{},c33=3D{},#1] \getvalue{flying-sheep@web.de:c11}%% \getvalue{flying-sheep@web.de:c12}%% and so on \protect } --=20 luigi --0016e65b645acd86530499719253 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

On Sun, Jan 9, 2011 at 11:13 PM, Philipp= A. <flying-she= ep@web.de> wrote:
hi list,

skip to the many %%% if you just want to help me ;)

= i need to make a macro which consists of ten optional arguments. it wouldn= =E2=80=99t be too ugly to require to write the following to use it, since i= t outputs a 3=C3=973 matrix with an adjacent tenth item, but tex can=E2=80= =99t handle ten arguments afaik.


syntax idea:
empty:
\bigcrafting%
{}{}{}%
{}{}{}{}%
{}{}{}%

partly filled:
\bigcrafting%
{}{}{}%
{planks}{plank= s}{}{workbench}%
{planks}{planks}{}%

how it should look:
3D"CraftingWorkbenchIO.png"
=
ok, since using empty =E2=80=9Crequired=E2=80=9D arguments aren=E2=80= =99t elegent, either, i wanted to get into key=3Dvalue sets, but ran into t= he next problem:

i wanted to instead define bigcrafting to work like this:
\bigcrafti= ng
=C2=A0 [21=3Dplanks, 22=3Dplanks,
=C2=A0=C2=A0 31=3Dplanks, 32=3Dp= lanks]
=C2=A0 [workbench]

but \getparameters = can=E2=80=99t handle numerical values.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

As Ha= ns wrote it's possible, but I like the to use "row" for row, = "col" for column and "c" for cell=C2=A0
i.e
\def\BigCrafting[#1]%
{\getparameters[Ph][c11=3D{},c12=3D{},= c13=3D{},
c21=3D{},c22=3D{},c23=3D{},c24=3D{},
c31=3D{}= ,c32=3D{},c33=3D{},#1]
\bTABLE
\bTR\bTD\getvalue{Phc11}= \eTD\bTD\getvalue{Phc12}\eTD\bTD\getvalue{Phc13}\eTD\eTR
\bTR\bTD\getvalue{Phc21}\eTD\bTD\getvalue{Phc22}\eTD\bTD\getvalue{Phc2= 3}\eTD\bTD\getvalue{Phc24}\eTD\eTR
\bTR\bTD\getvalue{Phc31}\eTD\b= TD\getvalue{Phc32}\eTD\bTD\getvalue{Phc33}\eTD\eTR
\eTABLE
}
\starttext
\BigCrafting[c11=3DFOO,c33=3DGOO,c22= =3DBOO,c24=3DZoo]
\BigCrafting[c11=3DFOO,c24=3DGOO]
\st= optext

You can also use a better namespace
\def\BigCrafting[#1]%
\unprotect
\getpara= meters[flying-sheep@web.de:][c11=3D{},c12=3D{},c13=3D{},
c21=3D{}= ,c22=3D{},c23=3D{},c24=3D{},
c31=3D{},c32=3D{},c33=3D{},#1]
\getvalue{flying-sheep@= web.de:c11}%%=C2=A0
\getvalue{flying-sheep@web.de:c12}%% and so on<= /div>
\protect
}

--
luigi

--0016e65b645acd86530499719253-- --===============1693329814== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --===============1693329814==--