Thanks for the silent help!

Joining 2 titlelists also works eg: see list3

<$macrocall $name="wikitext-example-without-html" 
src="""\function list1() d [[e e]] f +[format:titlelist[]join[ ]]

2 title-lists, which can be stored in a list-field
 
<$let list2={{{ a [[b b]] c +[format:titlelist[]join[ ]] }}}
list3={{{ [<list2>] [<list1>] +[join[ ]] }}}
>

<<list3>>

{{{ [enlist<list2>][enlist<list1>] }}}

or enlist list3

{{{ [enlist<list3>] }}}
</$let>
"""/>

I don’t have time to review today, but it looks impressive @pmario. Is there any possibility of a simple explanation of what is happening?

If we want to work with list-fields they do contain title-lists like title [[title with spaces]]

Eg: To read the list-field from HelloThere and create a link-list we can use:

{{{ [enlist{HelloThere!!list}] }}}
or
{{{ [[HelloThere]get[list]enlist-input[]] }}}

The later version is very flexible, since every element can be a variable. Eg:

\define tiddlerTitle() HelloThere
\define listName() list

{{{ [<tiddlerTitle>get<listName>enlist-input[]] }}}

[<tiddlerTitle> … defines the tiddler to be used
get<listName> … defines the name of the list-field and reads the title-list string
enlist-input[]] … converts it into an array of titles see: enlist-input docs

It will give us:

A Gentle Guide to TiddlyWiki
Discover TiddlyWiki
Some of the things you can do with TiddlyWiki
Ten reasons to switch to TiddlyWiki
Examples
What happened to the original TiddlyWiki?


If we want to dynamically create a variable that contains a title-list we need to crate a “title-list string” that can be stored in a list-field.

As Eric wrote if we assign a “filtered transclusion” to a variable we only get the first parameter. That has been a very early design decision.

\function list1() d [[e e]] f

<$let list2={{{ a [[b b]] c }}}>

If we have filtered-transclusions we need to convert them to a title-string, then it will be 1 parameter.

That’s exactly what the format and join operators do

\function list1() d [[e e]] f +[format:titlelist[]join[ ]]

<$let list2={{{ a [[b b]] c +[format:titlelist[]join[ ]] }}}

Now the variable title-list string can be used with enlist or enlist-input to be separated again

{{{ [enlist<list2>][enlist<list1>] }}}

While writing this response I also saw, that I forgot about this.
Instead of creating a string we can define one, with \procedure as follows.

\procedure list-p() d [[e e]] f

{{{ [<list-p>enlist-input[]] }}}

Hope that makes sense
-mario

  • One that persists in the new back tick subsitutions. It would be nice to have a bypass.

Thanks @pmario this is not voodo as I suspected in your examples,

To sumarise if you want a variable to contain a list, you may use titlelist to ensure spaces are allowed, and can use a “function”, you can use \define or \function to set the the variable to a list but not as a value of an attribute, perhaps the exception being a “filter”, inside the filter parameter on the set widget.

  • As someone who likes to use variables containing lists, I am being forced to use only a subset of methods.

As I did show, you can use the same methods, you can use with tiddler fields. An that is the “full set of methods” and not a subset.

I will revisit your examples, but given fields can only be given a value due to an edit or action (trigger) I still see it as a subset. I cant use the filtered transclusion or the new substitution forms, to set a variable to a list, because only the first will be used.

<$let title=HelloThere field=list my-list=`${ [<title>get<field>] }$` >
<<my-list>>
</$let>

If you want to see the title-list string you use the following code. The my-list variable is a string. So it is 1 element.

<$let title=HelloThere field=list my-list=`${ [<title>get<field>] }$` >
<$text text=<<my-list>> />
</$let>

If you want to use the variable with a list you need to split it into titles

<$let title=HelloThere field=list my-list=`${ [<title>get<field>] }$` >

<$text text=<<my-list>> />

---

<$list filter=`${ [<my-list>] }$`/>

---

<$list filter="[<my-list>enlist-input[]]"/>

</$let>

Which gives you this:

I think it’s only a matter of experimenting how the new substitution syntax can be used. I think it also is a users preference.

I personally prefer to do title concatenation the “old” way, because I think it is very flexible and simple to read.

From my point of view the first link-widget construction below is much easier to understand than the second one. Even if the second one is only 1 line, I think the first version is much more robust and much easier to maintain.

\function newTitle() [<currentTiddler>] [<now>] +[join[-]]

Old Style: <$link to=<<newTitle>>/>
<hr>
New Style: <$link to=`$(currentTiddler)$-${[<now>]}$` />

I am using similar approaches to you but looking through your examples, I see certain patterns are forced on you because,

  • when used as the values to an attribute, both the filtered transclusions and the new back tick filter substitution, only return the first value.
    • I understand why this maybe helpful, but not why as a result we have no way to assign more than only the first value to an attribute.
  • this means using these methods to set, let, vars or any widget or html attributes, they can not be used to provide a list.
  • I understand the workarounds but there is no way to override this behaviour, that returns only the first value, so a whole class of list handling and widgets is prohibited.
  • to me this is a clear limitation we should address.