Hi,
Am 16.04.2019 um 09:02 schrieb jtuchel@objektfabrik.de:
Hi Pharoers,
I may be a bit wrong on this list. I try anyways.
I am using Mustache to fill text into a String which will then be handed over to LaTeX. The Data I fill in comes from the Database.
Now the problem is this: if a String from the database contains an ampersand (like in 'Katz & Maus'), Mustache will replace special chars with HTML entities. That is fine in a web context, but LaTeX doesnt actually work well with HTML entities. I could, of course, remove the html entities after Mustache invested a lopt of work into creating them. But it seems more logical to keep Mustache from being so eager to help.
It is not logical because mustache is defined that way. So redefining does not improve it. But just use triple {{{ }}} to have strings not being escaped.
BTW: I already took the hurdle of Mustache excaping $& fir tabular environments (LaTeX uses the ampersand as a divider for table cells) by using \catcode in our .tex template files. But now the String comes from the database and so I am a bit lost...
So is there any best practice for this problem?
Yes, use it this way '{{{ value }}}' asMustacheTemplate value: { #value -> '&' } asDictionary Norbert