From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/6893 Path: main.gmane.org!not-for-mail From: Simon Pepping Newsgroups: gmane.comp.tex.context Subject: Re: DocBook probleempje Date: Thu, 14 Feb 2002 23:13:23 +0100 Sender: owner-ntg-context@let.uu.nl Message-ID: <20020214231323.A651@scaprea> References: <5.1.0.14.1.20020210215623.02f99fc8@server-1> <20020208220553.B384@scaprea> <5.1.0.14.1.20020210215623.02f99fc8@server-1> <20020211221547.A14372@scaprea> <5.1.0.14.1.20020213211323.035265d8@server-1> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1035397399 14802 80.91.224.250 (23 Oct 2002 18:23:19 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 23 Oct 2002 18:23:19 +0000 (UTC) Original-To: ntg-context@ntg.nl In-Reply-To: <5.1.0.14.1.20020213211323.035265d8@server-1>; from pragma@wxs.nl on Wed, Feb 13, 2002 at 09:15:45PM +0100 Xref: main.gmane.org gmane.comp.tex.context:6893 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:6893 Hans, This looks good. But it does not reproduce the order of the elements right if one of the elements does not occur in the first row, but does in one of the following: it comes last. I think it is too ambitious to dynamically determine the order in such cases. So I reworked your code for the case of a predetermined order. % first pass, header \unprotect % when the element occurs, register it \def\environmentSaveElement#1% {\defineXMLenvironmentsave[#1] {\@EA\gdef\csname used!#1\endcsname{1}} \donothing} % if the element is used, % typeset the TH cell and add element to the list of elements used \def\showElementTH#1{% \@EA\ifx\csname used!#1\endcsname\relax\else \bTD#1\eTD \doglobal\addtocommalist{#1}\ElementsUsed \fi } \protect % second pass, body % typeset the TD cell \def\showElementTD#1{\expanded{\bTD\XMLflush{#1}}\eTD} % for each revision, first clean out all elements, % then process the content, and finally typeset the saved elements \def\doRevision#1% {\processcommacommand[\ElementsUsed]\XMLerase #1% process content \bTR\processcommacommand[\ElementsUsed]\showElementTD\eTR} % save element \def\saveElement#1{\defineXMLsave[#1]} \defineXMLenvironmentsave[revhistory] {\bgroup} {% define element list \def\ElementList{revnumber,date,authorinitials,revremark,approved} % initialize elements used \gdef\ElementsUsed{} % define elements \processcommacommand[\ElementList]\environmentSaveElement % process content first pass \XMLflush{revhistory} \bTABLE % typeset header and construct the list of elements used; % the two-pass registration ensures % that the list of elements used % is in the same order as the element list \bTR\processcommacommand[\ElementList]\showElementTH\eTR % redefine revision and elements used \defineXMLargument[revision] \doRevision \processcommacommand[\ElementsUsed]\saveElement % process content second pass \XMLflush{revhistory}% \eTABLE \egroup} \starttext \startbuffer 0.06 2001-01-08 Changed date format (YYYY-MM-DD) 0.07 2001-01-09 gjf Changed date format (YYYY-MM-DD) again 0.08 gjf Changed date format (YYYY-MM-DD) once more \stopbuffer \processXMLbuffer \stoptext On Wed, Feb 13, 2002 at 09:15:45PM +0100, Hans Hagen wrote: > I already gambled on you asking this: > > % watch how we now redefine the #1 element to a saved one > > \def\WhatAHackA#1% > {\defineXMLenvironmentsave[#1] > {\doglobal\addtocommalist{#1}\CrapList > \bTD#1\eTD\defineXMLsave[#1]} > \donothing} > > % here we first erase them all, then save them when present, and finaly add > them to the table > > \def\WhatAHackB#1% > {\bTR > \processcommacommand[\CrapList]\XMLerase > #1% sets content > \processcommacommand[\CrapList]\WhatAHackC > \eTR} > > % a cell > > \def\WhatAHackC#1% > {\expanded{\bTD\XMLflush{#1}}\eTD} > > % a slightly different main macro > > \defineXMLenvironmentsave[revhistory] > {\bgroup} > {\def\HackList{revnumber,date,revremark,authorinitials} > \gdef\CrapList{} > \defineXMLenvironment[revision] \donothing \donothing > \processcommacommand[\HackList]\WhatAHackA > \bTABLE > \bTR\XMLflush{revhistory}\eTR > \defineXMLargument[revision] \WhatAHackB > \XMLflush{revhistory}% > \eTABLE > \egroup} > > % [still no aux file needed] > Groeten, Simon -- Simon Pepping email: spepping@scaprea.hobby.nl