Answer to question #1:

By default, titles resulting from a filter are only listed once, with the 
last instance of a given title "dominantly appended" to the list (i.e., 
duplicates are removed).  Thus, in your example, adding `[[foo]]` to the 
end of the list automatically removed the first instance of `foo` from the 
front of the list.  You've already discovered the use of the `:raw` suffix 
for the `enlist-input` operator, which prevents duplicates from being 
removed when you enlist an existing space-separated list.  Another bit of 
filter syntax that helps with preserving duplicates is the "=" prefix on a 
filter run.  To get the results you expected, you would write: `[[foo foo 
foo bar]enlist-input:raw[]] =[[foo]]`.

Answer to question #2:

As you noted in your followup message, you have an existing list stored in 
a tiddler field called `fieldName`.  Let's assume this field contains 4 
items: `foo [[bar baz]] mumble [[frotz gronk snork]]` (where the 2nd and 
4th items contain spaces).  To add an item to that list, you would write 
something like this:: `[<currentTiddler>get[fieldName]enlist-input:raw[]] 
=[<addedTitle>]`.  Note also that using `<currentTiddler>` in your filter 
is *slightly* more efficient than `all[current]`, since the `all[]` 
operator first needs to parse the operand (`current`) to determine that you 
want to retrieve the current tiddler's title, while `<currentTiddler>` 
directly retrieves the title without the added internal layer of parsing.

enjoy,
-e
On Wednesday, February 16, 2022 at 2:17:51 PM UTC-8 [email protected] 
wrote:

> Ok, so I have the following list:
>
>     foo foo foo bar
>
> I then want to append 'foo' to the end of that list such that I wind up 
> with:
>
>     foo foo foo bar foo
>
> So I try the following filter:
>
>     [[foo foo foo bar]enlist-input:raw[]] [[foo]]
>
> That results in:
>
>     foo foo bar foo
>
> This is unexpected to me, which means that there is something I don't 
> understand.
>
> So I have two questions:
>
> 1. Why is the title not appended as I expected?
> 2. How can I get the result I want? To add complexity (cause why not?), 
> the list will be generated dynamically based on user input, titles will 
> only sometimes be of existing tiddlers, and the titles can have spaces xD.
>

-- 
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/dff8b409-b0bc-4f67-b436-582bb2265f1fn%40googlegroups.com.

Reply via email to