Hi Tobias,
the setvars plugin is quite clever and it can select values from a list,
yes, but it does not give me the option to split a string (deserialize it)
based on a specified delimiter (e.g. ";;") and access the array indeces
later on.
* However:* The split filter is what I was looking for (in combination with
nth() filter)
<$list filter="a b c +[make[%count%;;%title%;;%max%]]" variable="s">
<div style="background: #ffffcc; padding: 3px; margin: 10px;">
''Serialized string:'' <<s>>
''Deserialized string:''
|!Index |!First Element |!Second Element |
|{{{ [<s>split[;;]nth[1]] }}}| {{{ [<s>split[;;]nth[2]] }}}| {{{
[<s>split[;;]nth[3]]
}}}|
</div>
</$list>
<https://lh3.googleusercontent.com/-8JfVrjjbVRw/Vnlhtr_yKhI/AAAAAAAAAHk/zZstmUAvLWA/s1600/2015-12-22%2B15%253A43%253A18.png>
*The combination of make, split and nth will definitely open doors for
people who want to do wikitext "for loops" in a way that is resembles
iterations over nested 2-dim-arrays*:
1. People can dynamically create nested arrays in wikitext on the fly
using the make filter in combination with a delimiter, e.g.";;".
2. Then they can iterate over the serialized sub-arrays and access the
array elements by index using split and nth
I always wished this was possible in TW ;) Hope my description helps others
who are also interested in advanced loops.
@Tobias there seems to be a bug though: do you notice the missing value in
the third iteration?
-Felix
Big compliment on your documentation of your plugins by the way.
On Sunday, 20 December 2015 00:00:16 UTC+1, Tobias Beer wrote:
>
> Hi Felix,
>
> Glad you like this little swiss-knife. :)
>
> Before we further discuss your proposals,
> I believe you can already do these things somewhat differently, but quite
> easily, I think.
> Now, it wouldn't work like your splitAndSelect macro, but what you could
> do instead is use...
>
> - tobibeer/setvars <http://tobibeer.github.io/tw5-plugins/#setvars>
> - a widget to create a bunch of variables in one go (capable of
> evaluating filters)
> - the crucial bit is that it is also capable of addressing and
> selecting values from a list!
> - and...
> - tobibeer/split <http://tobibeer.github.io/tw5-plugins/#split>
> - you guessed it, a simple filter to split stuff
> - by whichever separator you want
> - or at whichever position you want
>
> I hope it's not too much to ask (today it's a little too late for
> me anyway)... but,
> can you perhaps consider the above two alongside tobibeer/make
> <http://tobibeer.github.io/tw5-plugins/#make>
> and see if that won't achieve the same thing you have in mind, however,
> first creating variables you wrap your template / list-contents with?
>
> Best wishes,
>
> Tobias.
>
--
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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/10606bb1-f800-4835-a565-b7b3ff6f2924%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.