* scancsv module and lua
@ 2017-01-16 17:35 DesdeChaves
2017-01-16 17:45 ` DesdeChaves
0 siblings, 1 reply; 2+ messages in thread
From: DesdeChaves @ 2017-01-16 17:35 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1138 bytes --]
Dear sirs,
In my project I need to format some data from a csv file. The csv file is
scanned using the scancsv module and part of this information is formatted
inside luacode environment, but the text.print("") and the context("")
functions don´t be able to send the formatted data to the output. The
result is a empty pdf.
The example attached is from a old question.
Thanks a lot for your time
Jorge M.
--- example --
\usemodule[scancsv]
\def\ddmmyyyy#1#2#3{% #1 - date, #2 - old separator, #3 - new separator
\startlua
local parsedate=thirddata.scancsv.ParseCSVLine('#1','#2');
local day=tonumber(parsedate[1]);
local month=tonumber(parsedate[2]);
local year=tonumber(parsedate[3]);
-- tex.print(day..'#3'..month..'#3'..year);
text.print("Hello");
\stoplua
}
\unexpanded\def\lineaction{
\Name\ arrived on \ddmmyyyy{\Date}{/}{.\\,} \\
}
% Name;Date
% ME;11/10/14
% You;05/02/14
% He;15/02/2014
% She;03/03/12
% It;03/03/14
\setheader
\setsep{;}
\setfiletoscan{mail.csv}
\starttext
\filelineaction
\stoptext
[-- Attachment #1.2: Type: text/html, Size: 1811 bytes --]
[-- Attachment #2: Type: text/plain, Size: 492 bytes --]
___________________________________________________________________________________
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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: scancsv module and lua
2017-01-16 17:35 scancsv module and lua DesdeChaves
@ 2017-01-16 17:45 ` DesdeChaves
0 siblings, 0 replies; 2+ messages in thread
From: DesdeChaves @ 2017-01-16 17:45 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1362 bytes --]
Fixed. Sorry for the noise.
2017-01-16 17:35 GMT+00:00 DesdeChaves <desdechaves@gmail.com>:
> Dear sirs,
>
> In my project I need to format some data from a csv file. The csv file is
> scanned using the scancsv module and part of this information is formatted
> inside luacode environment, but the text.print("") and the context("")
> functions don´t be able to send the formatted data to the output. The
> result is a empty pdf.
>
> The example attached is from a old question.
>
> Thanks a lot for your time
>
> Jorge M.
>
> --- example --
>
> \usemodule[scancsv]
>
> \def\ddmmyyyy#1#2#3{% #1 - date, #2 - old separator, #3 - new separator
> \startlua
> local parsedate=thirddata.scancsv.ParseCSVLine('#1','#2');
> local day=tonumber(parsedate[1]);
> local month=tonumber(parsedate[2]);
> local year=tonumber(parsedate[3]);
> -- tex.print(day..'#3'..month..'#3'..year);
> text.print("Hello");
> \stoplua
> }
>
> \unexpanded\def\lineaction{
> \Name\ arrived on \ddmmyyyy{\Date}{/}{.\\,} \\
> }
>
>
> % Name;Date
> % ME;11/10/14
> % You;05/02/14
> % He;15/02/2014
> % She;03/03/12
> % It;03/03/14
>
> \setheader
> \setsep{;}
> \setfiletoscan{mail.csv}
>
> \starttext
> \filelineaction
> \stoptext
>
--
Atentamente
DesdeChaves
[-- Attachment #1.2: Type: text/html, Size: 2241 bytes --]
[-- Attachment #2: Type: text/plain, Size: 492 bytes --]
___________________________________________________________________________________
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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-16 17:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-16 17:35 scancsv module and lua DesdeChaves
2017-01-16 17:45 ` DesdeChaves
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).