* \e!start in lua
@ 2011-01-15 22:57 Aditya Mahajan
2011-01-16 8:52 ` Wolfgang Schuster
2011-01-16 16:08 ` Hans Hagen
0 siblings, 2 replies; 7+ messages in thread
From: Aditya Mahajan @ 2011-01-15 22:57 UTC (permalink / raw)
To: mailing list for ConTeXt users
What is the best way to define the equivalent of
\setvalue{\e!start\NAME}{...}
in lua.
e_start = ??
context.setvalue(e_start .. name, "...")
Thanks,
Aditya
___________________________________________________________________________________
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] 7+ messages in thread
* Re: \e!start in lua
2011-01-15 22:57 \e!start in lua Aditya Mahajan
@ 2011-01-16 8:52 ` Wolfgang Schuster
2011-01-16 16:27 ` Aditya Mahajan
2011-01-16 16:08 ` Hans Hagen
1 sibling, 1 reply; 7+ messages in thread
From: Wolfgang Schuster @ 2011-01-16 8:52 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 15.01.2011 um 23:57 schrieb Aditya Mahajan:
> What is the best way to define the equivalent of
>
> \setvalue{\e!start\NAME}{...}
>
> in lua.
>
> e_start = ??
> context.setvalue(e_start .. name, "...")
\startluacode
context.setvalue("foo","\\framedtext")
context.setvalue(table.concat({"start","foo"}),"\\startframedtext")
context.setvalue(table.concat({"stop" ,"foo"}),"\\stopframedtext" )
\stopluacode
\starttext
\foo{foo}
\startfoo bar\stopfoo
\stoptext
You can also write “context.setvalue("start".."foo","…")” but table.concat
looks better but the question is why don’t you use just tex
to create the start/stop commands.
Wolfgang
___________________________________________________________________________________
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] 7+ messages in thread
* Re: \e!start in lua
2011-01-16 8:52 ` Wolfgang Schuster
@ 2011-01-16 16:27 ` Aditya Mahajan
2011-01-16 17:03 ` Wolfgang Schuster
0 siblings, 1 reply; 7+ messages in thread
From: Aditya Mahajan @ 2011-01-16 16:27 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1069 bytes --]
On Sun, 16 Jan 2011, Wolfgang Schuster wrote:
>
> Am 15.01.2011 um 23:57 schrieb Aditya Mahajan:
>
>> What is the best way to define the equivalent of
>>
>> \setvalue{\e!start\NAME}{...}
>>
>> in lua.
>>
>> e_start = ??
>> context.setvalue(e_start .. name, "...")
>
> \startluacode
> context.setvalue("foo","\\framedtext")
> context.setvalue(table.concat({"start","foo"}),"\\startframedtext")
> context.setvalue(table.concat({"stop" ,"foo"}),"\\stopframedtext" )
> \stopluacode
>
> \starttext
> \foo{foo}
> \startfoo bar\stopfoo
> \stoptext
>
This would just create \startfoo. \setvalue{\e!start foo} creates a
interface specific command. The code that Hans posted does that. I am
sorry that this was not clear in the question.
> You can also write “context.setvalue("start".."foo","…")” but table.concat
> looks better
OK.
> but the question is why don’t you use just tex
> to create the start/stop commands.
Because I find it much easier to understand expansion at lua level than at
TeX level.
Thanks,
Aditya
[-- Attachment #2: Type: text/plain, Size: 486 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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: \e!start in lua
2011-01-15 22:57 \e!start in lua Aditya Mahajan
2011-01-16 8:52 ` Wolfgang Schuster
@ 2011-01-16 16:08 ` Hans Hagen
2011-01-16 16:28 ` Aditya Mahajan
1 sibling, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2011-01-16 16:08 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 15-1-2011 11:57, Aditya Mahajan wrote:
> What is the best way to define the equivalent of
>
> \setvalue{\e!start\NAME}{...}
>
> in lua.
>
> e_start = ??
> context.setvalue(e_start .. name, "...")
\starttext
\startluacode
local elements = interfaces.complete.elements
local interface = storage.shared.currentinterface
local e_start = elements.start[currentinterface]
local e_stop = elements.stop [currentinterface]
context.setvalue(e_start .. "something", "[[")
context.setvalue(e_stop .. "something", "]]")
\stopluacode
\startsomething Yes we can!\stopsomething
\stoptext
(i should probably preload elements as well)
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | 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] 7+ messages in thread
* Re: \e!start in lua
2011-01-16 16:08 ` Hans Hagen
@ 2011-01-16 16:28 ` Aditya Mahajan
2011-01-16 16:36 ` Hans Hagen
0 siblings, 1 reply; 7+ messages in thread
From: Aditya Mahajan @ 2011-01-16 16:28 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Sun, 16 Jan 2011, Hans Hagen wrote:
> On 15-1-2011 11:57, Aditya Mahajan wrote:
>> What is the best way to define the equivalent of
>>
>> \setvalue{\e!start\NAME}{...}
>>
>> in lua.
>>
>> e_start = ??
>> context.setvalue(e_start .. name, "...")
>
> \starttext
>
> \startluacode
>
> local elements = interfaces.complete.elements
> local interface = storage.shared.currentinterface
>
> local e_start = elements.start[currentinterface]
> local e_stop = elements.stop [currentinterface]
>
> context.setvalue(e_start .. "something", "[[")
> context.setvalue(e_stop .. "something", "]]")
>
> \stopluacode
>
> \startsomething Yes we can!\stopsomething
>
> \stoptext
Thank you.
Aditya
___________________________________________________________________________________
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] 7+ messages in thread
* Re: \e!start in lua
2011-01-16 16:28 ` Aditya Mahajan
@ 2011-01-16 16:36 ` Hans Hagen
0 siblings, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2011-01-16 16:36 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 16-1-2011 5:28, Aditya Mahajan wrote:
> On Sun, 16 Jan 2011, Hans Hagen wrote:
>
>> On 15-1-2011 11:57, Aditya Mahajan wrote:
>>> What is the best way to define the equivalent of
>>>
>>> \setvalue{\e!start\NAME}{...}
>>>
>>> in lua.
>>>
>>> e_start = ??
>>> context.setvalue(e_start .. name, "...")
>>
>> \starttext
>>
>> \startluacode
>>
>> local elements = interfaces.complete.elements
>> local interface = storage.shared.currentinterface
>>
>> local e_start = elements.start[currentinterface]
>> local e_stop = elements.stop [currentinterface]
>>
>> context.setvalue(e_start .. "something", "[[")
>> context.setvalue(e_stop .. "something", "]]")
>>
>> \stopluacode
>>
>> \startsomething Yes we can!\stopsomething
>>
>> \stoptext
>
> Thank you.
start[currentinterface] => start[interface]
a next beta will have interfaces.elements
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | 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] 7+ messages in thread
end of thread, other threads:[~2011-01-16 17:03 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-15 22:57 \e!start in lua Aditya Mahajan
2011-01-16 8:52 ` Wolfgang Schuster
2011-01-16 16:27 ` Aditya Mahajan
2011-01-16 17:03 ` Wolfgang Schuster
2011-01-16 16:08 ` Hans Hagen
2011-01-16 16:28 ` Aditya Mahajan
2011-01-16 16:36 ` 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).