Tag-words with spaces

I could need some help:
I’d like to create a new tiddler and put some tags on it.
This works so good as long the tag-words doesn’t have one or more spaces, leading to split a single tag into multiple.
I’m aware that one should use parenthesis to group some words to one title, but I don’t know how I can use it in a filter expression?
The tag words are derived from fields.

\procedure createnew()
<$action-createtiddler $basetitle={{!!sampleTitle}} text="This is a new tiddler" tags={{{ [{!!sampleTag1}addsuffix[ ]addsuffix{!!sampleTag2}addsuffix[ ]addsuffix{!!sampleTag3}] }}} $overwrite="yes" />
\end

Sample-Title:<$edit-text field="sampleTitle"/><br>
Sample-Tag-1:<$edit-text field="sampleTag1"/><br>
Sample-Tag-2:<$edit-text field="sampleTag2"/><br>
Sample-Tag-3:<$edit-text field="sampleTag3"/><br>

<$button actions=<<createnew>> >Create New</$button>

Please shed a light for me, thank you.


Instead of using addsuffix[ ] to join all the sampleTagN values together, use this:

tags={{{ [{!!sampleTag1}] [{!!sampleTag2}] [{!!sampleTag3}] +[format:titlelist[]join[ ]] }}}

Notes:

  • format:titlelist[] adds doubled square brackets around any sampleTagN value that contains spaces.
  • Then, those results are joined together with spaces to set the tags field value.

For example, when:

  • sampleTag1=“foo”
  • sampleTag2=“mumble frotz”
  • sampleTag3=“gronk”

the combined tags value will be:

foo [[mumble frotz]] gronk

enjoy,
-e

1 Like

Have a closer look at format:titlelist operator

The set-widget filter parameter also stores title-lists in variables

1 Like

Nice! That’s a simple solution which I didn’t think of.

I was adding spaces with addsuffix, because I didn’t know another (simple) solution in this moment. Somewhere in my backmind there was already a “join” creeping around, but it doesn’t work like I needed it. Searched the docs but used the wrong keyword (space), which doesn’t lead to a solution.

Excellent solution and detailed explanation, that’s what I really appreciate in your answers. Thank you very much!

One question:
How long are you using TiddlyWiki?

2 Likes

Yes, that’s the operator I was searching for.
Thanks for showing me the right direction!

1 Like

TiddlyWiki version 1.0 was released on Sept 20, 2004. I began my exploration of TiddlyWiki around 6 months later, in March, 2005, and published my first TiddlyWiki add-ons (“HTML formatting” and “Import Tiddlers”) in April/May of that year. I’ve been working closely with Jeremy on TWCore enhancements and providing help/admin for the TiddlyWiki community ever since then.

-e

Wow, that’s really impressive and explains your expertise very well.
Small wonder that I’m still in a very humble state when it comes to “program” for TW (using filters/macros/procedures/functions).
I started using TW very late, about 21 months ago.
I still ask myself why I didn’t use it earlier and what really frightens me is that I even didn’t know of it’s existence before.
Great tool and even better community!
Thanks to all of you .

1 Like