Hi Tobias,

Very(!!) nice filter you created! Quite revolutionary, I have to say.

It is more than just a very handy swiss army knife (uuid creation, 
concatinations, placeholders, *for loops* with the use of count, step and 
max directives, how cool!) – it opens the gate for a whole lot of 
possibilies! Great stuff.



*A proposal: *With your plugin, it is now possible for the first time to 
mix titles with other content on the fly in a sophisticated way using 
tw-filters.
However *your plugin would even become more powerful* if you included a 
macro that allows de-serialization afterwards.

*What this means:* In the filter expressions users can combine/merge/mix 
titles with other stuff and could use delimiters e.g. "---". Your plugin at 
the moment does a great job at serializing the data into one string that 
can be accessed later on.

*So in addition, it would be nice if you added a deserilzer function e.g. 
named "splitAndSelect" (**as a global macro).*

<$list filter="a b c +[make[%count%---%title%---%oddeven%%]]">

<!-- returns the counter -->
<<splitAndSelect separator:"---" index:"1" >>
<!-- returns the title -->
<<splitAndSelect "---" "2" >>
<!-- returns the "odd" or "even" depending on division of count by 2; could 
you implement that by the way ;) -->
<<splitAndSelect "---" "3" >>
<!-- returns and empty string as the 4th slot doesn't exist -->
<<splitAndSelect "---" "4" >>

<$list>

As you certainly guessed it, splitAndSelect is just a wrapper for a JS 
split and a subsequent array access operation (see code below).
You could copy the code of the splitAndSelect "macro" from TiddlyMap (I use 
it there for deserialization of lists in my own scenarios).       

var str = this.getVariable("currentTiddler");
var result = str.split(arguments[1])[arguments[2]];
      
return (result != null ? result : str);


In TiddlyMap I use it e.g. like this:

<$list filter="[[|Do not display a neighbourhood]]
               [[1|1 steps away]]
               [[2|2 steps away]] 
               [[3|3 steps away]] 
               [[*|No limit]]">
<$select>
<option value=<<tmap "splitAndSelect" "|" "0">>><<tmap "splitAndSelect" "|" 
"1">>
</$select>

</$list>

Which produces

<select>
  <option value="">Do not display a neighbourhood</option>
  <option value="1">1 steps away</option>
  <option value="2">2 steps away</option>
  <option value="3">3 steps away</option>
  <option value="*">No limit</option>
</select>


*Minor suggestion:*
As you noticed in the example above, I added a suggestion for an automatic 
variable %evenodd% that outputs "even" or odd" depending on the division by 
2. I guess that might come handy in the future?! On the other hand users 
could also write a macro for that task, so I am not sure if it really makes 
sense to include it as part of your plugin…

In summary: great job and I hope you can add the splitAndSelect thingy as a 
global macro which would be great for deserialization.

-Felix

*P.S.* Which github repo url to use for further discussing this plugin?

-- 
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/57ea88a9-cd86-4d06-86ec-8daf66ed375c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to