View Single Post
Old 03-25-2015, 10:49 AM   #10
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,461
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by eschwartz View Post
You don't strictly have to use GPM (when evaluating sub-templates), though, you *could* use TPM and substitute "[[" and "]]".
Actually, you can't use [[ and ]] in myki's template. The problem is the "| - |" stuff inside the quotes.

<Technical>
The template parser runs in two passes. The first, mostly controlled by the python 'format' library, extracts and parses { ... } template information. The second, mostly controlled by my code, extracts TPM functions from inside the program string using the GPM parser. The problem that arises is that the first parser sees the ':| - |' after the #series and connects it with the nearest opening brace ({), which when using [[ and ]] is the one in front of #categorieperso. The result is a mess, causing the parser to throw up its hands.

If you leave the { and } around the series ({series:| - |}) then the parser gets it right, attaching the prefix and suffix to the right variable. Unfortunately, because this parser and evaluator run before the program parser, this sub-template is evaluated and replaced with the result. If that result contains a significant character such as a quote, comma, bracket, or bar then the resulting argument for the template function will be bogus.

I have considered removing the [[ and ]] hack because the rules for successful use approach incomprehensible.
</Technical>
chaley is offline   Reply With Quote