Problem defining macro with Lua inside
Hello, I'm trying to define a macro (a MS Word -> clipboard -> Ctx tool), whose simplified form is the following: ---- \def\startWord{% \startluacode context[[ } \def\stopWord{% ]] \stopluacode } \starttext aaa \startWord abc def ghi \stopWord \stoptext ---- Unfortunately, I'm not able to define \startWord and \stopWord in a way that Ctx would accept. How to define it? Any help would be appreciated. Best regards, Lukas -- Ing. Lukáš Procházka | mailto:LPr@pontex.cz Pontex s. r. o. | mailto:pontex@pontex.cz | http://www.pontex.cz | IDDS:nrpt3sn Bezová 1658 147 14 Praha 4 Mob.: +420 702 033 396
On 05/30/2018 08:19 PM, Procházka Lukáš Ing. wrote:
Hello,
I'm trying to define a macro (a MS Word -> clipboard -> Ctx tool), whose simplified form is the following:
This cannot work \startluacode has to “see” \stopluacode. Use buffers: \unexpanded\def\startWord {\grabbufferdata[Word][startWord][stopWord]} \unexpanded\def\stopWord {\startluacode print(buffers.prepend("Word","context[[")) print(buffers.append("Word","]]")) \stopluacode \ctxluabuffer[Word]} \starttext \startWord abc def ghi \stopWord \stoptext
---- \def\startWord{% \startluacode context[[ }
\def\stopWord{% ]] \stopluacode }
\starttext aaa
\startWord abc def
ghi \stopWord \stoptext ----
Unfortunately, I'm not able to define \startWord and \stopWord in a way that Ctx would accept.
How to define it?
Any help would be appreciated.
Best regards,
Lukas
___________________________________________________________________________________ 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 ___________________________________________________________________________________
... Great, thank you!
Lukas
On Wed, 30 May 2018 13:47:12 +0200, Henri Menke
On 05/30/2018 08:19 PM, Procházka Lukáš Ing. wrote:
Hello,
I'm trying to define a macro (a MS Word -> clipboard -> Ctx tool), whose simplified form is the following:
This cannot work \startluacode has to “see” \stopluacode. Use buffers:
\unexpanded\def\startWord {\grabbufferdata[Word][startWord][stopWord]}
\unexpanded\def\stopWord {\startluacode print(buffers.prepend("Word","context[[")) print(buffers.append("Word","]]")) \stopluacode \ctxluabuffer[Word]}
\starttext
\startWord abc def
ghi \stopWord
\stoptext
---- \def\startWord{% \startluacode context[[ }
\def\stopWord{% ]] \stopluacode }
\starttext aaa
\startWord abc def
ghi \stopWord \stoptext ----
Unfortunately, I'm not able to define \startWord and \stopWord in a way that Ctx would accept.
How to define it?
Any help would be appreciated.
Best regards,
Lukas
-- Ing. Lukáš Procházka | mailto:LPr@pontex.cz Pontex s. r. o. | mailto:pontex@pontex.cz | http://www.pontex.cz | IDDS:nrpt3sn Bezová 1658 147 14 Praha 4 Mob.: +420 702 033 396
On 5/30/2018 10:19 AM, Procházka Lukáš Ing. wrote:
Hello,
I'm trying to define a macro (a MS Word -> clipboard -> Ctx tool), whose simplified form is the following:
---- \def\startWord{% \startluacode context[[ }
\def\stopWord{% ]] \stopluacode }
\starttext aaa
\startWord abc def
ghi \stopWord \stoptext ----
Unfortunately, I'm not able to define \startWord and \stopWord in a way that Ctx would accept.
How to define it?
Any help would be appreciated.
just define a buffer and do something with it afterwards -- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (3)
-
Hans Hagen
-
Henri Menke
-
Procházka Lukáš Ing.