How to create list of tiddlers and pass to tabs macro?

133 views
Skip to first unread message

talha131

unread,
Jul 14, 2018, 2:46:17 PM7/14/18
to TiddlyWiki

I am trying to create a list a tiddlers inside tabs

<<tabs "[[Clean Noise]][[Rename File]]" default:"" state:"$:/state/tab1" class:"tc-vertical" template="$:/talha131/Template/VerticalTab">>

The tiddlers are

  1. Clean Noise
  2. Rename File

I am going to add more to the list.

Is it possible to create a list or an array and then pass it to tabs macro? Something like

let aList = [
'Clean Noise', 
'Rename 
'Other example'
];

<<tabs <aList> default:""  state:"$:/state/tab1" class:"tc-vertical"  template="$:/talha131/Template/VerticalTab">>

The advantage of this format is clear. I can add tiddlers to the list easily. The syntax is clearer than putting everything inside a filter. Is it possible?

The obvious work around, I can think of, is to tag those tiddlers and use the tag inside tabs macro. But I wonder if it is possible to do without creating a new tag for few tiddlers, just to get tabs transclusion working.

talha131

unread,
Jul 14, 2018, 2:51:39 PM7/14/18
to TiddlyWiki
Additionally, the reason I don't want to use tags is the order of the tiddlers.

I want to tiddlers to appear in a specific order. I can do that with tag by dragging and dropping but that order is reflected everywhere.

If I want to have to orders, one sorted by title and other manually, then I will have to create two tags.

Mark S.

unread,
Jul 14, 2018, 3:26:30 PM7/14/18
to TiddlyWiki
What? You think an actual programming language might be easier to understand than widgets! Heresy! ;-)

The list field (s) is the closest thing to arrays in WikiText.

So you could put [[Clean House]] [[Rename File]] into the list field of a tiddler called "aList". Then your tabs could look like:


<<tabs "[list[aList]]" default:"" state:"$:/state/tab1" class:"tc-vertical" template="$:/talha131/Template/VerticalTab">>

-- Mark

talha131

unread,
Jul 15, 2018, 10:36:55 AM7/15/18
to TiddlyWiki

The list field (s) is the closest thing to arrays in WikiText.

Ouch! I think I will stick with using tags then. I don’t think editing field of a tiddler would be as convenient as arrays in programming languages.

Thank you Mark.

Jed Carty

unread,
Jul 15, 2018, 10:51:59 AM7/15/18
to TiddlyWiki
There is nothing stopping you from using javascript if that is what you would rather use. It isn't like the features of Javascript have been removed from tiddlywiki.

talha131

unread,
Jul 15, 2018, 11:00:06 AM7/15/18
to TiddlyWiki

Right. I have seen some example JS macros. In the examples, a simple parameter is passed to JS macro and it returns an output.

Currently, I am not sure how JS is used with TW constructs like tabs macro for example.

Say I create a JS macro, that returns a list of tiddlers. How do I use it with tabs?

Jed Carty

unread,
Jul 15, 2018, 11:12:04 AM7/15/18
to TiddlyWiki
It would be something like this:

<$set name=someList value=<<yourJavascriptFanciness>>>
<$macrocall $name=tabs filter=<
<someList>>/>
</$set>

the interface between javascript and the much maligned widgets can be a bit complex because the widgets are designed to make markup tasks simple. One result of the simplicity and usability is a reduction in functionality as compared to a complete programming language.

But if javascript is as simple as implied than there should be no trouble just making what is necessary in javascript without the widgets.

Jed Carty

unread,
Jul 15, 2018, 11:17:20 AM7/15/18
to TiddlyWiki
If perhaps you just want to use tiddlywiki than you can just write out a list and have it work the way you want, like this:

in one tiddler, lets call it 'Tabs List' put the list of tabs you want like this (in the text field with nothing else):

Tab1
Tab2
[[Tab3 has spaces in the name]]

then in the tiddler where you want your tabs displayed use this:

<<tabs "[enlist{Tabs List}]">>

you can of course call the list tiddler whatever you want, just change the "[enlist{Tabs List}]" and replace Tabs List with the tiddler title.

You can also do the same thing using a list field by just writing the list in the field in the same way (any whitespace works between titles, it doesn't have to be new lines)

talha131

unread,
Jul 16, 2018, 11:18:55 AM7/16/18
to TiddlyWiki

Thanks Jed, this enlist solution is perfect for my needs. I was looking for exactly the same format.

the interface between javascript and the much maligned widgets can be a bit complex because the widgets are designed to make markup tasks simple.

Haha, seems like there is a fault line in the community over JS vs widgets that I am yet to learn :)

Reply all
Reply to author
Forward
0 new messages