Re: [NTG-context] date calculated with currentdate plus n days
On 08/14/2018 09:24 AM, Henri Menke wrote:
> On 14/08/18 17:29, Pablo Rodriguez wrote:
>> [...]
>> Where are those context.* Lua commands documented?
>>
>> I want to generate an xtable using Lua code, but I don’t know where to read.
>
> They aren't documented because they are just the context commands. You
> can read more about how it works in
> http://www.pragma-ade.nl/general/manuals/cld-mkiv.pdf
Many thanks for your reply, Henri.
I remember paging through the manual, it’s included in the distribution.
I rewrote your sample as (xtables are the only tables I know in ConTeXt):
\starttext
\startlua
context.startxtable()
context.startxrow()
context.startxcell()
context("Note 1")
context.stopxcell()
context.startxcell()
context("Note 2")
context.stopxcell()
context.stopxrow()
context.startxrow()
context.startxcell()
context("Note 3")
context.stopxcell()
context.startxcell()
context("Note 4")
context.stopxcell()
context.stopxrow()
context.stopxtable()
\stoplua
\stoptext
Many thanks for your help,
Pablo
--
http://www.ousia.tk
___
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] / 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
___
Re: [NTG-context] date calculated with currentdate plus n days
On 14/08/18 17:29, Pablo Rodriguez wrote:
On 08/14/2018 01:46 AM, Henri Menke wrote:
On top of that I recommend to use context.date to get the correct
formatting according to the current language options:
\def\duedate{\ctxlua{
local t = os.date('*t', os.time()+ 10 * 24 * 3600)
context.date{ d = t.day, m = t.month, y = t.year }
}}
Many thanks for your reply, Henri.
Where are those context.* Lua commands documented?
I want to generate an xtable using Lua code, but I don’t know where to read.
They aren't documented because they are just the context commands. You
can read more about how it works in
http://www.pragma-ade.nl/general/manuals/cld-mkiv.pdf
Here a little sample with an xtable:
\starttext
\startluacode
local function duedate()
local t = os.date('*t', os.time()+ 10 * 24 * 3600)
context.date{ d = t.day, m = t.month, y = t.year }
end
context.startxtable{frame = "off"}
context.NC() context("Note") context.NC() context("Date") context.NR()
context.NC() context("Hand in before") context.NC() duedate()
context.NR()
context.stopxtable()
\stopluacode
\stoptext
Many thanks for your help,
Pablo
___
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] / 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
___
Re: [NTG-context] date calculated with currentdate plus n days
On 08/14/2018 01:46 AM, Henri Menke wrote:
> On top of that I recommend to use context.date to get the correct
> formatting according to the current language options:
>
> \def\duedate{\ctxlua{
>local t = os.date('*t', os.time()+ 10 * 24 * 3600)
>context.date{ d = t.day, m = t.month, y = t.year }
> }}
Many thanks for your reply, Henri.
Where are those context.* Lua commands documented?
I want to generate an xtable using Lua code, but I don’t know where to read.
Many thanks for your help,
Pablo
--
http://www.ousia.tk
___
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] / 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
___
Re: [NTG-context] date calculated with currentdate plus n days
On top of that I recommend to use context.date to get the correct
formatting according to the current language options:
\starttext
\def\duedate{\ctxlua{
local t = os.date('*t', os.time()+ 10 * 24 * 3600)
context.date{ d = t.day, m = t.month, y = t.year }
}}
\duedate
\stoptext
On 14/08/18 05:37, Jan U. Hasecke wrote:
On 13.08.2018 17:57, Pablo Rodriguez wrote:
if you don’t mind using Lua, here you have it:
\starttext
\def\duedate{\cldcontext{os.date('\letterpercent d/\letterpercent
m/\letterpercent Y', os.time()+ 10 * 24 * 3600)}}
\duedate
\stoptext
Just in case it helps,
Thanks!
I thought it should be possible with lua, but I found no entry point to
use lua in context by defining new commands.
juh
___
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] / 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
___
___
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] / 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
___
Re: [NTG-context] date calculated with currentdate plus n days
On 13.08.2018 17:57, Pablo Rodriguez wrote:
> if you don’t mind using Lua, here you have it:
>
> \starttext
> \def\duedate{\cldcontext{os.date('\letterpercent d/\letterpercent
> m/\letterpercent Y', os.time()+ 10 * 24 * 3600)}}
>
> \duedate
> \stoptext
>
> Just in case it helps,
Thanks!
I thought it should be possible with lua, but I found no entry point to
use lua in context by defining new commands.
juh
___
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] / 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
___
Re: [NTG-context] date calculated with currentdate plus n days
On 08/13/2018 05:19 PM, Jan U. Hasecke wrote:
> Hi all,
>
> I want to insert a due date for payments in my invoice and I would like
> to calculate it from \currentdate. Something like
>
> define \duedate = \currentdate plus 10 days
>
> Is this possible?
Hi Jan-Ulrich,
if you don’t mind using Lua, here you have it:
\starttext
\def\duedate{\cldcontext{os.date('\letterpercent d/\letterpercent
m/\letterpercent Y', os.time()+ 10 * 24 * 3600)}}
\duedate
\stoptext
Just in case it helps,
Pablo
--
http://www.ousia.tk
___
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] / 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
___
[NTG-context] date calculated with currentdate plus n days
Hi all, I want to insert a due date for payments in my invoice and I would like to calculate it from \currentdate. Something like define \duedate = \currentdate plus 10 days Is this possible? juh ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : [email protected] / 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 ___
