* How to store command line arguments in ConTeXt LUA Documents?
@ 2016-03-13 12:43 Romain Diss
2016-03-13 13:24 ` Hans Hagen
0 siblings, 1 reply; 4+ messages in thread
From: Romain Diss @ 2016-03-13 12:43 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hi all,
Is it possible to store context command line arguments into lua
variables?
I found http://wiki.contextgarden.net/Command/getdocumentargument but it
only prints the argument. I can not store it for further processing.
What I would like to do is something like this:
-- start of the example
something = context.getcommandlineargument("ARG1") -- doesn't exist
-- make some tests here to check if 'something' has the right syntax
context.startdocument{title = something}
context.input("knuth")
context.stopdocument()
-- end of the example
Then, one has just to launch:
$ context file.cld --ARG1="My first title"
Thanks in advance.
--
Romain Diss
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to store command line arguments in ConTeXt LUA Documents?
2016-03-13 12:43 How to store command line arguments in ConTeXt LUA Documents? Romain Diss
@ 2016-03-13 13:24 ` Hans Hagen
2016-03-14 21:46 ` Romain Diss
0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2016-03-13 13:24 UTC (permalink / raw)
To: ntg-context
On 3/13/2016 1:43 PM, Romain Diss wrote:
> Hi all,
>
> Is it possible to store context command line arguments into lua
> variables?
>
> I found http://wiki.contextgarden.net/Command/getdocumentargument but it
> only prints the argument. I can not store it for further processing.
>
> What I would like to do is something like this:
>
> -- start of the example
> something = context.getcommandlineargument("ARG1") -- doesn't exist
> -- make some tests here to check if 'something' has the right syntax
> context.startdocument{title = something}
> context.input("knuth")
> context.stopdocument()
> -- end of the example
>
> Then, one has just to launch:
> $ context file.cld --ARG1="My first title"
environment.arguments
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | 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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to store command line arguments in ConTeXt LUA Documents?
2016-03-13 13:24 ` Hans Hagen
@ 2016-03-14 21:46 ` Romain Diss
2016-03-15 9:14 ` Hans Hagen
0 siblings, 1 reply; 4+ messages in thread
From: Romain Diss @ 2016-03-14 21:46 UTC (permalink / raw)
To: mailing list for ConTeXt users
> >Is it possible to store context command line arguments into lua
> >variables?
> > [...]
> >What I would like to do is something like this:
> >
> >-- start of the example
> >something = context.getcommandlineargument("ARG1") -- doesn't exist
> >-- make some tests here to check if 'something' has the right syntax
> >context.startdocument{title = something}
> >context.input("knuth")
> >context.stopdocument()
> >-- end of the example
> >
> >Then, one has just to launch:
> >$ context file.cld --ARG1="My first title"
>
> environment.arguments
Thank you. It works very well.
I did not find this table in any documentation. Did I forget something?
If I want to document it, what is the best place?
- http://wiki.contextgarden.net/Command/getdocumentargument
- another place in the wiki which evokes lua environment tables...
All the best.
--
Romain Diss
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to store command line arguments in ConTeXt LUA Documents?
2016-03-14 21:46 ` Romain Diss
@ 2016-03-15 9:14 ` Hans Hagen
0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2016-03-15 9:14 UTC (permalink / raw)
To: ntg-context
On 3/14/2016 10:46 PM, Romain Diss wrote:
>>> Is it possible to store context command line arguments into lua
>>> variables?
>>> [...]
>>> What I would like to do is something like this:
>>>
>>> -- start of the example
>>> something = context.getcommandlineargument("ARG1") -- doesn't exist
>>> -- make some tests here to check if 'something' has the right syntax
>>> context.startdocument{title = something}
>>> context.input("knuth")
>>> context.stopdocument()
>>> -- end of the example
>>>
>>> Then, one has just to launch:
>>> $ context file.cld --ARG1="My first title"
>>
>> environment.arguments
> Thank you. It works very well.
>
> I did not find this table in any documentation. Did I forget something?
>
> If I want to document it, what is the best place?
> - http://wiki.contextgarden.net/Command/getdocumentargument
> - another place in the wiki which evokes lua environment tables...
maybe expand the lua section of the wiki
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | 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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-03-15 9:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-13 12:43 How to store command line arguments in ConTeXt LUA Documents? Romain Diss
2016-03-13 13:24 ` Hans Hagen
2016-03-14 21:46 ` Romain Diss
2016-03-15 9:14 ` Hans Hagen
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).