Well, that's not quite the solution after all, because I keep getting this
error:
Uncaught RangeError: Maximum call stack size exceeded
I don't have issues with the macro on tiddlywiki.com, so I don't know what
I'm doing wrong. Can anyone figure out what's wrong?
I'm using the macro in the caption field like this:
<$macrocall $name="padder" str={{!!cnum}} len=2/>: {{!!title}}
The idea is to have the title replaced in link-lists with the caption,
which shows the card number (cnum) and the title of the card, ala "05 :
Cilantro" or "08 : Emerald".
And just in case, this is the macro definition I used (from that link I
posted before, which is Mark S's code:
\define padder-reg() ^$(len)$$
\define padder(str,len,chr:"0")
<$vars len=<<__len__>>>
<$list filter="[<__str__>addprefix<__chr__>]" variable="padstr">
<$list filter="[<padstr>length[]!regexp<padder-reg>]" emptyMessage=<<padstr
>>>
<$macrocall $name="padder" str=<<padstr>> len=<<__len__>> chr=<<__chr__>>/>
</$list>
</$list>
</$vars>
\end
On Saturday, December 12, 2020 at 7:30:58 PM UTC-7 [email protected] wrote:
> This thread has what I needed:
> https://www.mail-archive.com/[email protected]/msg91214.html
> <https://www.mail-archive.com/[email protected]/msg91214.html>
>
>
> On Thursday, December 10, 2020 at 6:19:09 PM UTC-7 Eric Shulman wrote:
>
>> On Thursday, December 10, 2020 at 5:05:04 PM UTC-8 [email protected]
>> wrote:
>>
>>> There is a pad[] filter operator in the very soon to be released TW
>>> 5.1.23
>>
>>
>> prior to TW5.1.23, padding can be done using split[] and join[], like
>> this:
>>
>> <$vars num="12">
>> {{{ [<num>addprefix[00000]split[]last[5]join[]] }}}
>> <$vars>
>>
>> The resulting output is "00012". Note that if the num value has more
>> than 5 digits, it will be truncated to only show the last 5 digits.
>>
>> -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/a650e573-9b79-4ce6-b0d3-28eb6f82578fn%40googlegroups.com.