Hello, I've a little feature request: It would be nice, to have a command line option like "--setvalue x=y" or similar for the "context" command to define a variable for the job. Modes are already very nice, but often I need just one value for conditional compiling a document instead of many binary switches. Perhaps the "context --arguments" option is what I'm looking for, but I didn't find how to use it. Another option would be, to make the name of the result-file ("context --result=...") available, for example as "\resultname". Cheers, Peter -- Contact information: http://pmrb.free.fr/contact/
On Fri, 18 Sep 2009, Peter Münster wrote:
I've a little feature request: It would be nice, to have a command line option like "--setvalue x=y" or similar for the "context" command to define a variable for the job.
Modes are already very nice, but often I need just one value for conditional compiling a document instead of many binary switches.
Perhaps the "context --arguments" option is what I'm looking for, but I didn't find how to use it.
Hello, After reading a bit in mtx-context.lua, I've found out how to use --arguments: test-file: \starttext Value of myVar: \ctxlua{tex.print(document.arguments["arguments=myVar"])} \stoptext cmd-line: context --arguments=myVar=myValue test But this syntax is very strange! This would be much nicer: Value of myVar: \getvariable{environment}{myVar} Perhaps there is just a bug in the evaluation of environment.arguments? That means, instead of using the first equal sign (=) for generating the key/value pair, the last one is used.
Another option would be, to make the name of the result-file ("context --result=...") available, for example as "\resultname".
Is this the right way to go: \systemparameter{file} ? Cheers, Peter -- Contact information: http://pmrb.free.fr/contact/
On Sun, Sep 20, 2009 at 9:46 PM, Peter Münster
On Fri, 18 Sep 2009, Peter Münster wrote:
I've a little feature request: It would be nice, to have a command line option like "--setvalue x=y" or similar for the "context" command to define a variable for the job.
Modes are already very nice, but often I need just one value for conditional compiling a document instead of many binary switches.
Perhaps the "context --arguments" option is what I'm looking for, but I didn't find how to use it.
Hello,
After reading a bit in mtx-context.lua, I've found out how to use --arguments:
test-file:
\starttext Value of myVar: \ctxlua{tex.print(document.arguments["arguments=myVar"])} \stoptext
cmd-line:
context --arguments=myVar=myValue test
But this syntax is very strange! Does context --arguments="myVar=myValue" test work too ? -- luigi
On Sun, 20 Sep 2009, luigi scarso wrote:
test-file:
\starttext Value of myVar: \ctxlua{tex.print(document.arguments["arguments=myVar"])} \stoptext
cmd-line:
context --arguments=myVar=myValue test
But this syntax is very strange! Does context --arguments="myVar=myValue" test work too ?
Yes, I'm using bash, so --arguments="myVar=myValue" is the same as --arguments=myVar=myValue That means, context does not see the quotes. But I've also tried this: context --arguments=\"myVar=myValue\" test Error: MTXrun | unknown script 'context --arguments="myVar=myValue.lua' or 'mtx-context --arguments="myVar=myValue.lua' Cheers, Peter -- Contact information: http://pmrb.free.fr/contact/
On Mon, Sep 21, 2009 at 7:39 AM, Peter Münster
On Sun, 20 Sep 2009, luigi scarso wrote:
test-file:
\starttext Value of myVar: \ctxlua{tex.print(document.arguments["arguments=myVar"])} \stoptext
cmd-line:
context --arguments=myVar=myValue test
But this syntax is very strange! Does context --arguments="myVar=myValue" test work too ?
Yes, I'm using bash, so --arguments="myVar=myValue" is the same as --arguments=myVar=myValue
That means, context does not see the quotes. OK, in this way syntax looks less strange -- luigi
On Mon, 21 Sep 2009, luigi scarso wrote:
test-file:
\starttext Value of myVar: \ctxlua{tex.print(document.arguments["arguments=myVar"])} \stoptext
cmd-line:
context --arguments=myVar=myValue test
But this syntax is very strange! Does context --arguments="myVar=myValue" test work too ?
Yes, I'm using bash, so --arguments="myVar=myValue" is the same as --arguments=myVar=myValue
That means, context does not see the quotes. OK, in this way syntax looks less strange
It's not the syntax of the cmd-line that looks strange, it's the syntax how to get the value of the variable: \ctxlua{tex.print(document.arguments["arguments=myVar"])} I'm quite sure, that this is not Hans' intention. As I've written yesterday, I suppose, that the following syntax is wanted: \getvariable{environment}{myVar} but this does not work... Cheers, Peter -- Contact information: http://pmrb.free.fr/contact/
Peter Münster wrote:
On Mon, 21 Sep 2009, luigi scarso wrote:
test-file:
\starttext Value of myVar: \ctxlua{tex.print(document.arguments["arguments=myVar"])} \stoptext
cmd-line:
context --arguments=myVar=myValue test
But this syntax is very strange! Does context --arguments="myVar=myValue" test work too ? Yes, I'm using bash, so --arguments="myVar=myValue" is the same as --arguments=myVar=myValue
That means, context does not see the quotes. OK, in this way syntax looks less strange
It's not the syntax of the cmd-line that looks strange, it's the syntax how to get the value of the variable: \ctxlua{tex.print(document.arguments["arguments=myVar"])}
I'm quite sure, that this is not Hans' intention.
As I've written yesterday, I suppose, that the following syntax is wanted: \getvariable{environment}{myVar} but this does not work...
how does it look with: local flag, value = argument:match("^%-+(.-)=(.-)$") .+ -> .- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Mon, 21 Sep 2009, Hans Hagen wrote:
As I've written yesterday, I suppose, that the following syntax is wanted: \getvariable{environment}{myVar} but this does not work...
how does it look with:
local flag, value = argument:match("^%-+(.-)=(.-)$")
.+ -> .-
I've changed the line in mtxrun.lua and now it works fine, thanks Hans! There is another occurrence of this line in luatools.lua (line 3426), perhaps it should be changed there too? Cheers, Peter -- Contact information: http://pmrb.free.fr/contact/
Peter Münster wrote:
On Mon, 21 Sep 2009, Hans Hagen wrote:
As I've written yesterday, I suppose, that the following syntax is wanted: \getvariable{environment}{myVar} but this does not work... how does it look with:
local flag, value = argument:match("^%-+(.-)=(.-)$")
.+ -> .-
I've changed the line in mtxrun.lua and now it works fine, thanks Hans!
There is another occurrence of this line in luatools.lua (line 3426), perhaps it should be changed there too?
will happen automatically with the next beta ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (3)
-
Hans Hagen
-
luigi scarso
-
Peter Münster