![](https://secure.gravatar.com/avatar/74d41c3215dcdd377343cdc47311757c.jpg?s=120&d=mm&r=g)
1 Nov
2019
1 Nov
'19
4:08 a.m.
Pablo Rodriguez schrieb am 01.11.2019 um 10:44: > 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? 1. Fix it in the module to ensure special characters are treated as letters. 2. Use the asciimode environment to make TeX's special characters normal letters. \starttext \startasciimode % & # $ ^ ~ \stopasciimode \stoptext Wolfgang