On 2012-03-07 15:28, Procházka Lukáš Ing. - Pontex s. r. o. wrote: > Hello, > > I'd need to to hook \stoptext by Lua - I'd need to write something right > before the end of the text. > > See the simple example: > > ---- t-Hook.mkiv > \startluacode > local stoptext_p = context.stoptext > > context.stoptext = function(...) > context("END") > stoptext_p(...) > end > \stopluacode > > \starttext > \input knuth > \stoptext % To be hooked by Lua > ---- > > This code should write "END" right before the end of the document, but it > doesn't.
context.stoptext() just calls “\stoptext”, not the other way round. Btw CLD are implemented as metatable so afaik you would have to redefine the “__index” attribute. > How to achieve that? ········································································ \startluacode local old_stoptext = commands.stoptext commands.stoptext = function(...) context"END" old_stoptext(...) end \stopluacode \starttext \input knuth \stoptext % To be hooked by Lua ········································································ Cf. file.job.mkvi at line 107. Hth Philipp > > - I'd rather Lua to TeX do the job as I need Lua to do more complicated > things (the example above is very simplified). > > TIA. > > Best regards, > > Lukas > > > -- > Ing. Lukáš Procházka [mailto:l...@pontex.cz] > Pontex s. r. o. [mailto:pon...@pontex.cz] [http://www.pontex.cz] > Bezová 1658 > 147 14 Praha 4 > > Tel: +420 244 062 238 > Fax: +420 244 461 038 > ___________________________________________________________________________________ > 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 > ___________________________________________________________________________________ -- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments
pgpTUvNSb5rPL.pgp
Description: PGP signature
___________________________________________________________________________________ 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 ___________________________________________________________________________________