On 11/5/23 13:56, Pablo Rodriguez via ntg-context wrote:
> [...]
> I get an error about an unexpected symbol near "\" in the line of
> "\processdatabasefile".
>
> Could anyone enlighten me about what I am missing here?

Replying to myself, thanks to the wiki
(https://wiki.contextgarden.net/Commands_with_optional_arguments).

It seems that the command has to be defined as unexpanded, such as in:

  \setupinteraction[state=start]
  \setupattachments[method=hidden]
  \usemodule[database]

  \starttext

  \unexpanded\def\ItemContents#1#2#3{\doiftext{#2}
    {\item {\em #1}\attachment[file=#2, name=\currentitemnumber-#2]%
      \doiftext{#3}{ (also available at #3)}}}

  \defineseparatedlist
     [test]
     [separator={,},
      quotechar={"},
      before={\startitemize[n]},after={\stopitemize},
      first={\ItemContents},last={.},
      left={\{},right={\}}]

  \processdatabasefile[test][context-documents.csv]

  \stoptext

It is not clear for me why is this needed, but it might be one of the
many aspects of expansion that average users cannot understand from TeX.

Many thanks for your help,

Pablo
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to