Okay nevermind; I got it; I found the subtract filter operator works great
if you don't mind your tabs starting at 0; and I fixed it in the code above.
On Monday, 20 April 2020 15:31:31 UTC-4, leeand00 wrote:
>
> When I read something, and I throw it into the wiki, I have a tendency to
> chunk it into smaller examples...
>
> When I do this I use the "Excise" functionality to split the long text
> out; it works great but...when I want to split it into tabs the tabs show
> up with their full titles, and I'd prefer if I didn't have to go to every
> single tiddler and add a caption, tooltip and order for ever single one; so
> in looking into this I wrote the following macro so that they are
>
>
>
> <$button>
> <!-- 1. The title of the current tiddler is obtained into the
> whichTiddlerTag variable
> at this level that is what you get (unless of course you are in
> draft mode...in which case,
> I guess you could use !!draft.of instead? )
> -->
> <$set name="whichTiddlerTag" value=<<currentTiddler>> >
> <!-- 2. Obtain a count of how many tiddlers have been Excised / tagged
> with this tiddler's title -->
> <$list filter="[tag<whichTiddlerTag>count[]subtract[1]]">
> <!-- 3. A range is generated from 1 to number of excised tiddlers which is
> now occupying the currentTiddler variable.-->
> <$list filter="[range<currentTiddler>]">
> <!-- 4. For each item in the range from 1 to number of excised tiddlers
> obtain the tiddler name into whichTiddler based on currentTiddler's
> 1,2,3,4... -->
> <$set name="whichTiddler" filter="[tag<whichTiddlerTag>]" select=<
> <currentTiddler>> >
> <!-- 5. whichTiddler contains the name of an individual excised tiddler
> and currentTiddler is the number in the list. -->
> <$action-setfield $tiddler=<<whichTiddler>>
> $field="caption" $value=<<currentTiddler>> />
> <$action-setfield $tiddler=<<whichTiddler>>
> $field="tooltip" $value=<<whichTiddler>> />
> <$action-setfield $tiddler=<<whichTiddler>> $field="order"
> $value=<<currentTiddler>> />
> </$set>
> </$list>
> </$list>
> </$set>
> Set Tab Order, Tooltips and Captions
> </$button>
>
> <!-- Displays tabs when we are in draft mode -->
> <<tabs "[tag{!!title}]">>
>
> <!-- Displays tabs when we are in view mode -->
> <<tabs "[tag{!!draft.of}]">>
>
>
> The script sort of works...not exactly...the first tiddler is always
> skipped, I'm assuming because the select attribute of $set under 4. wants
> to start with 0 instead of 1 and I don't know how to decrement it though
> there are a number of Mathematical operators that have been added to
> Tiddlywiki since I last looked at it.
>
> But anyway making this work would save massive amounts of time in wikiing,
> any suggestions on how to make this work?
>
> Also the currentTiddler variable and how it changes makes the code almost
> unreadable!
>
--
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/da8ed47b-52c0-4622-b47f-6d86a6a6ac21%40googlegroups.com.