Trying to use fields to create variable-length lists

71 views
Skip to first unread message

Don Eisele

unread,
Jan 11, 2018, 2:55:17 PM1/11/18
to TiddlyWiki
I'm trying to use fields to create a list, and am running into troubles  (I just started using TiddlyWiki last night).


I found this plugin which looks like it will do exactly what I want:



However, I still have trouble.


I'm trying to create a bullet list from a field, split upon a character (let's say ";").

It seems like something like:
<$list filter="[{!!myfield}split[;]"/>


would do the trick, but I'm just not getting anything.

I've tried a ton of combinations to no avail.


If it's easier, a solution that involved multiple fields would be fine too.
   * {{!!myfield1}}
   
* {{!!myfield2}}
   
* {{!!myfield3}}


but open ended so I could just use myfield*

One other thing I noticed is in the examples the plugin lists a lot of:
  {{{   .....    }}}}


Sometimes I'm getting things from those examples, others not.   I didn't find in the documentation on how to use that construct.   I'm thinking maybe if it's an array I'm getting no output, but I'm not sure.

Mark S.

unread,
Jan 11, 2018, 3:07:16 PM1/11/18
to TiddlyWiki
You might just consider using list fields, rather than splitting by some token. That way you maintain continuity with the core TW. But that's just my view point.

If Tobias' filter works like other filters, then you have an error. It should be:


<$list filter="[{!!myfield}split[;]]"/>

Notice the final closing square bracket.

Good luck!
-- Mark

Diego Mesa

unread,
Jan 11, 2018, 3:20:43 PM1/11/18
to TiddlyWiki
Hi Don,

The `{{{` syntax is called "Filtered Transclusion" and is explained here:

https://tiddlywiki.com/#Transclusion%20in%20WikiText

It is used to transclude a list of tiddlers matching a specified filter.

Diego

Don Eisele

unread,
Jan 11, 2018, 4:01:26 PM1/11/18
to TiddlyWiki
The error you pointed out was just me transcribing to the post.. no beans there.

However, from your suggestion, I figured out how to use list fields, and they will do what I want :)

Just a different way of thinking than I am used to for programming, had to wrap my head around it.

Thanks!

Don Eisele

unread,
Jan 11, 2018, 4:01:59 PM1/11/18
to TiddlyWiki
Awesome, that's definitely more clear.    I had found the {{, but missed the {{{

Don Eisele

unread,
Jan 11, 2018, 5:09:34 PM1/11/18
to TiddlyWiki
Well.. I spoke a little soon...   Something still isn't processing right:

<$list filter={{!!myfield}} />

If the field looks like:

[[display text|tiddler link1]]
[[display text|tiddler link2]]

It's displaying the entire text including "|" and the link, and also linking to a tiddler with the entirety.

Any thoughts?

Mark S.

unread,
Jan 11, 2018, 6:16:01 PM1/11/18
to TiddlyWiki
List fields may look like a series of links, but actually each element in the list is the name of the tiddler (no |description). So your list inside "myfield" might look like:

  [[Learning]] [[HelloThere]]

and you can list them out like:

<$list filter=[enlist{!!myfield}] />

To label them with some alternate text, you could add a caption or description field to the tiddlers. Then your list might look like:

<$list filter="[enlist{!!myfield}]" >
<$link><$view field="description"/></$link><br/>
</$list>


(In general use descriptions for longer descriptions of a tiddler, and caption for short, button-friendly descriptions)

HTH
-- Mark
Reply all
Reply to author
Forward
0 new messages