list widget quirk-- the KAOS variable

48 views
Skip to first unread message

A Gloom

unread,
Oct 6, 2019, 3:48:02 PM10/6/19
to TiddlyWiki
Overcame the last hurdle holding up "Searchin high n low" and it was fixed with... kaos coding (cause I didn't knowing did it-- goes against what i would do) so I can truly say my wiki has "KAOS inside"

The " variable="" " in the list widget below was initially put in to use but never was-- so its not being used by the list-- but if I remove it, the list breaks.  As long as it remains, regardless of the variable name used or left empty, the list works-- hence the kaos value.

<$set name="urlfinal" value={{$:/temp/refwikiurl}}>
<div style="margin-bottom:10px; padding:0px 0px 4px 10px; border:dotted 2px;">
<
<refwikiurlfinal>><br/>
<$list filter="[[reference wikis bookmarks]indexes[]]" >
<$list filter="[[reference wikis bookmarks]getindex
<currentTiddler>search:title{$:/temp/refwikiurl}]" variable="kaos">
<
<currentTiddler>>
&bull; ''Version:'' <$view tiddler="reference wikis bookmarks version" index=<
<currentTiddler>>/><br/>
&bull; ''Has:'' <$view tiddler="reference wikis bookmarks material" index=<
<currentTiddler>>/><br/>
<$set name="data" tiddler="reference wikis bookmarks toc" index=<
<currentTiddler>> >
Table of contents:
<br/><$select tiddler='$:/temp/refwikitoc' default=""><$list filter=<<data>>+[encodeuri[]]><option value=<<currentTiddler>>><$view field="title" format="text" /></option></$list></$select><br/>
</$set></$list>
</$list>



For the uninitiated: KAOS/kaos = Kats Against
Organization and Sanity (formerly Kittens)

Mark S.

unread,
Oct 6, 2019, 3:57:05 PM10/6/19
to TiddlyWiki
If you didn't set the variable, then <<currentTiddler>> would contain whatever the inner list widget returns. Instead it uses whatever the outer list widget returns.

Sometimes in this situation I use variable="dummy" to remind me that the variable doesn't do anything.

TonyM

unread,
Oct 6, 2019, 7:14:55 PM10/6/19
to TiddlyWiki
I will second marks comment.

I often use variable=nul to indicate I will not be using the the result within the list, for example when using list to determine when something is displayed, and especially if inside the list I want access to currentTiddler (the containing tiddler), particularly in the view template. As soon as I decide to make use of the variable within the list I give it a name that represents what it is that is being listed. Thus returning to my code later I always see if I use nul that I do not care about the value, if I see no variable I am using currentTiddler (Equivalent to variable=currentTiddler) and if I use a named variable (other than nul) the name reflects what in fact the list is doing/listing eg; variable=closed-task.

The same variable name can be used inside a list but its value only changes within that list, once the list is closed the variable will return to its original value.

Regards
Tony
Reply all
Reply to author
Forward
0 new messages