ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Cc: ntg-context@ntg.nl
Subject: Re: DocBook probleempje
Date: Wed, 13 Feb 2002 21:15:45 +0100	[thread overview]
Message-ID: <5.1.0.14.1.20020213211323.035265d8@server-1> (raw)
In-Reply-To: <20020211221547.A14372@scaprea>

At 10:15 PM 2/11/2002 +0100, you wrote:
>On Sun, Feb 10, 2002 at 10:04:15PM +0100, Hans Hagen wrote:
>
>First the problem in English:
>
>I want to render the revhistory as a table. But it may have a large
>range of fields. Preferably I would like to be able to see which
>fields occur, and only include those columns.
>
>This code works fine, and it teaches me that it is not necessary to
>write to an auxiliary file. All data can be built in memory.
>
>But I want more. The following is an appropriate test text. Each row
>may show a different selection from the possible fields. And all rows
>together may only use a subset of the set of possible fields. I only
>want to include the fields actually used; so I do not want to show the
>field authorinitials if that is not used in any of the rows.

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]

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                                   fall-back web server: 
www.pragma-pod.nl
-------------------------------------------------------------------------


  reply	other threads:[~2002-02-13 20:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20020208220553.B384@scaprea>
2002-02-10 21:04 ` Hans Hagen
2002-02-11 21:15   ` Simon Pepping
2002-02-13 20:15     ` Hans Hagen [this message]
2002-02-14 22:13       ` Simon Pepping
2002-02-15  7:46         ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5.1.0.14.1.20020213211323.035265d8@server-1 \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).