[NTG-context] \setvariables and database module

Otared Kavian otared at gmail.com
Tue Jan 30 15:44:02 CET 2018


Hi all,

I need to create a document using a database and the \setvariables command (which I understood thanks to Wolfgang Schuster). Everything works fine except that using the approach below I need to change the entries in the database by enclosing each entry between a pair of braces {}, because otherwise the macro I have imagined does not work as expected. In the example below the first line of entries is treated correctly, while the second one is understood wrongly by my macro \maketalk defined below in the minimal example.

It is indeed possible, in theory, to change the database file so that each entry is enclosed in a pair of braces, but I would like to avoid that mainly because I am not the one who produces nor maintains that file and I want to avoid modifying a copy of that file myself.

How can I change my approach to this problem in order to achieve what is needed?
Many thanks for any hint.
Best regards: OK

% begin database-command.tex
\usemodule[database]

\starttext
\startbuffer[pagetalk]
	\starttabulate[|f{\bi}l|p|][before=]%
	\NC Speaker \EQ 
	\goto{{\sc \getvariable{talk}{speakername}}}[fig:\getvariable{talk}{speakername}]
	 \NC\NR
	\NC Title   \EQ \getvariable{talk}{title}    \NC\NR
	\stoptabulate
	\startplacefigure[number=no]
		\externalfigure[\getvariable{talk}{picture}]
	\stopplacefigure
	\page
\stopbuffer

\setvariable{talk}{set}{\getbuffer[pagetalk]}

\define[3]\maketalk{%
	\setvariables[talk]%
		[speakername={#1},
		title={#2},
		picture={#3},
		]}

\defineseparatedlist[seplisttalk]
	[separator={;},
	first=\maketalk
	]

\startseplisttalk
{Hacker} ; {Up to date hacking} ; {hacker.jpg} % this works fine
Hacker ; Up to date hacking ; hacker.jpg % this does not work: the macro takes only the three characters H a c
\stopseplisttalk

\stoptext
% end database-command.tex


More information about the ntg-context mailing list