Otared Kavian <mailto:ota...@gmail.com>
30. Januar 2018 um 15:44
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
]
Use the command key which grabs the content of each column as argument
(i.e. your commands needs as many arguments as your table has columns):
\defineseparatedlist
[seplisttalk]
[separator={;},
command=\maketalk]
Wolfgang
___________________________________________________________________________________
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
___________________________________________________________________________________