[NTG-context] Different versions of Lua and error in the same versions of ConTeXt (Fedora vs Win7)

Hans Hagen pragma at wxs.nl
Mon Feb 23 09:36:45 CET 2015


On 2/22/2015 9:42 PM, Pablo Rodriguez wrote:
> On 02/22/2015 07:44 PM, Hans Hagen wrote:
>> [...]
>> for pablo: there are csv scanners built in context
>
> Hans,
>
> I don’t really need this at home, but I’m interested in this.

there are several variants, here is one:

\starttext

\startluacode

local mycsvsplitter = utilities.parsers.rfc4180splitter()

local crap = io.loaddata("c.txt")

local list, names = mycsvsplitter(crap,true)   inspect(list) inspect(names)
local list, names = mycsvsplitter(crap)        inspect(list) inspect(names)

context.starttabulate { "|l|r|" }
for i=1,#list do
     local l = list[i]
     context.NC() context(l[1])
     context.NC() context(l[3])
     context.NC()
     context.NR()
end
context.stoptabulate()

\stopluacode

\stoptext


> I guess you mean m-database.mkiv. But I don’t have a clue on how to
> handle it.
>
> I mean, how to ignore the first line and how to make commands from the
> so-called cells (A2, B5...; to use them in document combination) reading
> an external file.
>
> Many thanks for your help,
>
> Pablo
>


-- 

-----------------------------------------------------------------
                                           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
-----------------------------------------------------------------


More information about the ntg-context mailing list