Mikael P. Sundqvist <mailto:mic...@gmail.com>
3. November 2016 um 16:14
Dear Otared (and others),
while waiting for Hans reply on the \namedenumerationparameter and
\enumerationparameter, this is the best I could do. Now, only
"Question" is clickable and not the number, but I think I could live
with that if no other solution show up.
The reference value is set in a group and can only be accessed within
this group
but you can use \currentconstructionreference to access it.
\setupinteraction[state=start]
\define[1]\QuestionTextCommand
{\doifreferencefoundelse{answer:\cldcontext{lpeg.match(lpeg.secondofsplit(":"),"\currentconstructionreference")}}
{\goto{#1}[answer:\cldcontext{lpeg.match(lpeg.secondofsplit(":"),"\currentconstructionreference")}]}
{#1}}
\define[1]\AnswerTextCommand
{\doifreferencefoundelse{question:\cldcontext{lpeg.match(lpeg.secondofsplit(":"),"\currentconstructionreference")}}
{\goto{#1}[question:\cldcontext{lpeg.match(lpeg.secondofsplit(":"),"\currentconstructionreference")}]}
{#1}}
\defineenumeration [question]
[text=Question,headcommand=\QuestionTextCommand]
\defineenumeration [answer] [text=Answer,headcommand=\AnswerTextCommand]
\starttext
\startquestion[question:knuth]
\input knuth
\stopquestion
\page
\startanswer[answer:knuth]
\input knuth
\stopanswer
\stoptext
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
___________________________________________________________________________________