Hi
On Tuesday, 27 October 2015 13:16:20 UTC+2, Tobias Beer wrote:
>
>
> I see, so you are required to specify the operand using text-references or
> variables for multiple items.
>
Not a requirement -- a simple list such as [one two [[and three]]] also
works
> Perhaps it is more consistent to use the same syntax of the list filter
> here, e.g:
>
> filter="[list[some-list]prepend:5[some-tiddler!!some-list]]
>
> instead of:
>
> filter="[list[some-list]prepend:5{some-tiddler!!some-list}]
>
I didn't choose this convention -- this is standard syntax for references
inside filter expressions -- if the list were referenced this should also
be:
filter="[list{mytext!!reference}prepend{....
Also, reading the filter code, this should never do anything, it appears:
>
> if (append === "") {
>
> ...as you have cast append into an array like so:
>
> append = $tw.utils.parseStringArray(operator.operand);
>
>
Aha -- I haven't done any tests on these -- should this be append === [],
in this case?
> Here's a test that does not do as I expect:
>
> title: test
> x: [[foo bar]] baz mumble frotz
> y: [[aaaa bbbb]]] cccc mumble eeee
>
> {{{ [list[!!x]append:3{!!y}] }}}
>
> which outputs this list:
>
> - foo bar
> - baz
> - mumble
> - frotz
> - aaaa bbbb]
> - cccc
> - mumble
>
> That's due to the triple ]]] after the bbbb -- the item gets read as aaaa
bbbb]
> But should output a set as all other filters appear to do:
>
> - foo bar
> - baz
> - frotz
> - aaaa bbbb
> - cccc
> - mumble
>
> I have not enforced single instances of items in any of the filter
operators (although they were designed with single instances in mind.) Many
operations currently enforce this, for example appending another run --
it's easy to do but I'm not sure if this is the best way to go. Rather,
this default behaviour of lists may need modification, or at least this
behaviour should be optional, as there is a need for repeat items in many
types of list.
One of my examples clearly displays this behaviour -- when first appended,
multiple instances of an item are permitted, on the first update, the list
becomes collapsed to single instances (due to the + before the next run.)
> In other words, it should work exactly the same as:
>
> {{{ [list[!!x]] [[aaaa bbbb]] cccc mumble }}}
>
> Should it not?
>
> Same for using a variable *y* instead of a field *y*.
>
> Best wishes,
>
> — tb
>
regards
--
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/8293b473-b704-4cca-8c56-ac4ac160de98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.