ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: "Hiding" columns in m-database & TABLE
Date: Thu, 22 Nov 2012 18:55:20 +0100	[thread overview]
Message-ID: <50AE6708.5020109@wxs.nl> (raw)
In-Reply-To: <20121122153645.7bf5be85@aga-netbook>

On 11/22/2012 3:36 PM, Marcin Borkowski wrote:
> Dnia 2012-11-22, o godz. 13:26:52
> Mojca Miklavec <mojca.miklavec.lists@gmail.com> napisał(a):
>
>> On Thu, Nov 22, 2012 at 12:57 PM, Marcin Borkowski wrote:
>>> le) in order to
>>> typeset a (nice) TABLE. However, I have a few columns I'd like to
>>> omit.  I can (of course) hand-edit the csv file; but is there a way
>>> to do it automatically?  Something like
>>>
>>> \setupTABLE[column][3,4,5][kill]
>>>
>>> I did [empty=yes,width=0pt] in place of [kill], and it worked, but
>>> it seems like a hack (and I don't know whether it does actually
>>> process the cells I'm omitting - which in my case wouldn't bother
>>> me, but might be an additional layer of inelegance;)).  And better
>>> ideas?
>>
>> If you have up to 9 columns, you could use
>>
>>      \def\ProcessingLine#1#2#3#4#5#6#7{%
>>          \bTR\bTD#1\eTD\bTD#2\eTD\bTD#6\eTD\bTD#7\eTD}
>>
>> and then [command=\ProcessingLine]
>
> Well, something like 20 columns (on A4 landscape). ;)
>
> It turns out that my method somehow doesn't work well without setting
> also height=0pt; then it's fine, but I'm still wondering about a
> cleaner way.

I've added a splutter to the core:

\startluacode

local mycsvsplitter = utilities.parsers.csvsplitter {
     separator = ",",
     quote     = '"',
}

local crap = [[
"1","2","3","4"
"a","b","c","d"
]]

local mycrap = mycsvsplitter(crap)

context.bTABLE()
     for i=1,#mycrap do
         context.bTR()
         local c = mycrap[i]
         for i=1,#c do
             context.bTD()
             context(c[i])
             context.eTD()
         end
         context.eTR()
     end
context.eTABLE()

\stopluacode

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  parent reply	other threads:[~2012-11-22 17:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-22 11:57 Marcin Borkowski
2012-11-22 12:26 ` Mojca Miklavec
2012-11-22 14:36   ` Marcin Borkowski
2012-11-22 16:12     ` Alan BRASLAU
2012-11-22 17:55     ` Hans Hagen [this message]
2012-11-23 12:38       ` Philipp Gesang
2012-11-23 16:40         ` 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=50AE6708.5020109@wxs.nl \
    --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).