On Saturday, December 12, 2020 at 7:40:44 PM UTC-8 [email protected] wrote:

> Uncaught RangeError: Maximum call stack size exceeded 
>

This error is indicative of a run-away recursion.  Without digging into the 
code myself, I'm not sure why this is the case.  In any event, I suggest 
entirely avoiding the complexity (and processing overhead) of recursion by 
using the following alternative macro definition:
\define padder(str,len) {{{ 
[[$str$]addprefix[0000000000]split[]last[$len$]join[]] }}}

This will work to pad numbers up to 10 digits long (as determined by the 
number of zeros in the addprefix[...] operator) and you would use it in 
exactly the same way as the recursive macro:
<$macrocall $name="padder" str={{!!cnum}} len="2" />

Note that, starting with the soon to be released TW v5.1.23, there is a new 
filter operator, pad[...], which will accomplish the same result without 
needing any custom macro definition.
To use this new filter, you would just write the following inline filter 
instead of using <$macrocall ...>
{{{ [{!!cnum}pad[2]] }}}

enjoy,
-e

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/e7f56c27-bb5e-4045-a57a-220f87949a16n%40googlegroups.com.

Reply via email to