On 11/1/19 9:13 AM, Wolfgang Schuster wrote: > Pablo Rodriguez schrieb am 01.11.2019 um 08:20: >> [...] >> I don’t know why I do get the second attachment, but not the first one. >> Lua code seems to be fine (given the last command in the sample). >> >> Could anyone explain me what I’m doing wrong? > > You try to pass a protected (\expanded\def) command to a argument of > another command > which doesn't work: Remove \unexpanded and your output is as expected. > > \def\giveattachment#1% > {\cldcontext{document.special_attachment("#1")}}
Many thanks for your reply, Wolfgang. Now I understand why it didn’t work. In my real-world document, I get an error, probably caused by having \giveattachment deployed in a buffer called inside: \start \catcode`\#=12 % local change of character TeX category \doloopif{\cA}{~=}{}{\getbuffer[main]} \stop This \start..\stop is required to get identifiers in urls (such as http://a.b/c#d). urls are read from a CSV file using the handlecsv module. Is there any way to avoid this issue? > \def\giveattachment > {\cldcontext{document.special_attachment(tokens.scanners.string())}} I’m afraid I cannot make this work. Many thanks for your help, Pablo -- http://www.ousia.tk ___________________________________________________________________________________ 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 ___________________________________________________________________________________