From: DesdeChaves <desdechaves@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: scancsv module and lua
Date: Mon, 16 Jan 2017 17:35:13 +0000 [thread overview]
Message-ID: <CAPBmU9EBQ1=HQpv2CtmDFhwyTTG+w3myj11KG5dgksVUBqV2cw@mail.gmail.com> (raw)
[-- 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
___________________________________________________________________________________
next reply other threads:[~2017-01-16 17:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-16 17:35 DesdeChaves [this message]
2017-01-16 17:45 ` DesdeChaves
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='CAPBmU9EBQ1=HQpv2CtmDFhwyTTG+w3myj11KG5dgksVUBqV2cw@mail.gmail.com' \
--to=desdechaves@gmail.com \
--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).