How to get simple i=i+2 in wiki macros?

36 views
Skip to first unread message

Siniy-Kit

unread,
Nov 28, 2021, 12:58:53 PM11/28/21
to TiddlyWiki
Hi! I write a simple  macros on https://tiddlywiki.com/

<$vars a=0>
<$list filter="[tag[TableOfContents]]">
<$vars a={{{[<a>add[2]]}}}> <<a>></$vars> <<currentTiddler>> <br/> 
</$list>
</$vars>
 
and I see this

HelloThere
2 Learning
2 Working with TiddlyWiki
2 Customise TiddlyWiki
2 Features
2 Languages
2 Editions
2 Plugins
2 Platforms
2 Reference
2 Community
2 About

but I want to  see this

HelloThere
4 Learning
6 Working with TiddlyWiki
8 Customise TiddlyWiki
10 Features
12 Languages
14 Editions
16 Plugins
18 Platforms
20 Reference
22 Community
24 About

where is my mistake?

Charlie Veniot

unread,
Nov 28, 2021, 1:25:00 PM11/28/21
to TiddlyWiki
Hi,

It looks like you are treating TiddlyWiki and widgets like a programming language, trying to do iteration in each loop.  That doesn't work.

Take a look at the "counter" attribute in list widget.  That is a relatively new feature to help handle what you are doing.

To get the desired output:

<$list filter="[tag[TableOfContents]]" counter="a">
<$text text={{{ [<a>multiply[2]]}}}/> <<currentTiddler>> <br/> 
</$list>

Siniy-Kit

unread,
Nov 29, 2021, 2:26:32 AM11/29/21
to TiddlyWiki
Thank you Cj. And how can we get this list?
HelloThere
1Learning
1 Working with TiddlyWiki

2 Customise TiddlyWiki
2 Features
2 Languages
3 Editions
3 Plugins
3 Platforms
4 Reference
4 Community
4 About




воскресенье, 28 ноября 2021 г. в 21:25:00 UTC+3, cj.v...@gmail.com:

Eric Shulman

unread,
Nov 29, 2021, 6:11:32 AM11/29/21
to TiddlyWiki

Use this calculation: `<$text text={{{ [<a>subtract[1]divide[3]trunc[]add[1]] }}}/>`

enjoy,

-e

Reply all
Reply to author
Forward
0 new messages