From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/42878 Path: news.gmane.org!not-for-mail From: "Wolfgang Schuster" Newsgroups: gmane.comp.tex.context Subject: Re: Making a template, defining a macro Date: Thu, 31 Jul 2008 08:37:41 +0200 Message-ID: <115224fb0807302337r2766d882rc30c516ac255d6c8@mail.gmail.com> References: <20080730181856.utckzb62zo8s0c8o@webmail.opentransfer.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1217486362 1473 80.91.229.12 (31 Jul 2008 06:39:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 31 Jul 2008 06:39:22 +0000 (UTC) To: "mailing list for ConTeXt users" Original-X-From: ntg-context-bounces@ntg.nl Thu Jul 31 08:40:09 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 1KORpV-0005Ka-CE for gctc-ntg-context-518@m.gmane.org; Thu, 31 Jul 2008 08:40:05 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id F419D1FC0D; Thu, 31 Jul 2008 08:39:08 +0200 (CEST) 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 05581-02-3; Thu, 31 Jul 2008 08:38:19 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 6F2821FBEF; Thu, 31 Jul 2008 08:38:19 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id C70AC1FBEF for ; Thu, 31 Jul 2008 08:38:16 +0200 (CEST) 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 06053-01-6 for ; Thu, 31 Jul 2008 08:37:43 +0200 (CEST) Original-Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.242]) by ronja.ntg.nl (Postfix) with ESMTP id 54E911FBD4 for ; Thu, 31 Jul 2008 08:37:42 +0200 (CEST) Original-Received: by an-out-0708.google.com with SMTP id c8so67043ana.14 for ; Wed, 30 Jul 2008 23:37:42 -0700 (PDT) Original-Received: by 10.100.8.4 with SMTP id 4mr14159056anh.38.1217486261926; Wed, 30 Jul 2008 23:37:41 -0700 (PDT) Original-Received: by 10.100.109.20 with HTTP; Wed, 30 Jul 2008 23:37:41 -0700 (PDT) In-Reply-To: <20080730181856.utckzb62zo8s0c8o@webmail.opentransfer.com> Content-Disposition: inline X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 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:42878 Archived-At: On Thu, Jul 31, 2008 at 1:18 AM, Demi=E1n Gutierrez = wrote: > Hi, > > I have to prepare a template to typeset a document that will have a > lot of tables of similar kinds repeated across the document. I want to > put that tables in some kind of templates, so I can use those > templates over and over. So the idea is to hide to the authors all the > format details behind the template allowing them to focus on the data > that has to be filled in those tables (which is the important thing). > > So, I would like to define some macros, that allows me to do something li= ke: > > \starttableX > \startSomeField > Some Field Value... > \stopSomeField > > \startOtherField > Other Field Value... > \stopOtherField > \stoptableX > > And the result, should be a table like this: > > | Some Field Label: | Some Field Value... | > | Other Field Label: | Other Field Value... | > > That way I define a template for each table type I'll have in the documen= t. > > I'm not having trouble with the tables, but with the macro definition, > this is my approximation of what I want (which does not work): > > \startsetups crudmain > \long\def\startguiname #1 \stopguiname{\setvariables[crudmain][guiname= =3D#1]} > \long\def\startclassname #1 > \stopclassname{\setvariables[crudmain][classname=3D#1]} > > GUI Name: \getvariable{crudmain}{guiname} > Class Name: \getvariable{crudmain}{classname} > \stopsetups > > \definestartstop[crudmain][commands=3D\setups{crudmain}] > > \startcrudmain > \startguiname > Some name here... > \stopguiname > \startclassname > Other name here... > \stopclassname > \stopcrudmain > > At this point I'm getting this error: > > ! Use of \startguiname doesn't match its definition. > > I want the \long\def\startguiname inside the \startsetups / > \stopsetups to be sure that it will only be called inside the > \startcrudmain / \stopcrudmain (Cause other tables of different types > may have fields with the same name). But even considering the previous > point, if I move the \long\def\startguiname outside the \startsetups / > \stopsetups definition it does not works, because the > \getvariable{crudmain}{guiname} just returns blank. > > So is it possible to do what I want or something similar? What would > be a good way to do it? Any advice on the code I've already written? > This is really getting me crazy, cause context is not like any other > programming language I'm used to use ;-) \def\startcrudmain {\bgroup \def\startguiname##1\stopguiname {\setvalue{crudmain:guiname}{##1}}% \def\startclassname##1\stopclassname {\setvalue{crudmain:classname}{##1}}} \def\stopcrudmain {\bTABLE[frame=3Doff]% \bTR \bTD GUI Name: \eTD \bTD \getvalue{crudmain:guiname} \eTD \eTR \bTR \bTD Class Name: \eTD \bTD \getvalue{crudmain:classname} \eTD \eTR \eTABLE \egroup} \starttext \startcrudmain \startguiname Some name here... \stopguiname \startclassname Other name here... \stopclassname \stopcrudmain \stoptext Wolfgang ___________________________________________________________________________= ________ If your question is of interest to others as well, please add an entry to t= he Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-cont= ext webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________= ________