Comparison between Tobias's plugins "split" and "setvars"

81 views
Skip to first unread message

ParisWiki

unread,
Dec 18, 2015, 6:23:30 AM12/18/15
to TiddlyWiki

@Tobias,

I had been testing your "split" plugin which does almost what I needed: exploding a chain of characters extracted from a data tiddler. But I was worried that the different extracts were de facto links, appearing as blue italic sequences within my table.

This morning, going back to your excellent plugins lab, I realised that your "setvars" plugin could extract tidbits from a long chain and NOT transform them as links but keep them as plain vanilla words.

<$setvars foo="bar[2,3]" _bar="a b c d e">
<<foo>>
</$setvars>


I prefer that. Except that the splitting character is a space. How can I transform that in order to have some other spliting character, such as "|", "§" or ";"  ? The reason is that some of my extract are sentences (with spaces).
I tried to insert "non secable spaces". It work fine, but up to a point, since they prevent automatic line break if the sentence is longer than my cell or the screen of a smartphone ...

Thank you for your time !

Regards,
JCG

Tobias Beer

unread,
Dec 18, 2015, 7:24:20 AM12/18/15
to tiddl...@googlegroups.com
Hi JCG,

You're almost there. :D

The answer is: The setvars widget can evaluate filters.
So, essentially what you would do is evaluate filter attributes which use the split filter, e.g.:

<$setvars foo="[bar[1]] \—\ [bar[2]]" _bar="[[foo$bar]split[$]]">
<
<foo>>
</$setvars>

The above would turn foo$bar into foo—bar.

Best wishes,

Tobias.

Tobias Beer

unread,
Dec 18, 2015, 7:48:27 AM12/18/15
to tiddl...@googlegroups.com
Hi again, JCG,

Looks like you have found a bug. Good! :D

I just released version 0.5.2 that fixes it. Get the update from here:


The problem was that I erroneously stringified single values into list items, e.g.

"Nice to meet you!" would have been rendered as a link in the last example here:


...since it contained spaces. Now it's not anymore stringified, so it does not render as a link.

Best wishes,

Tobias.

Tobias Beer

unread,
Dec 18, 2015, 8:34:59 AM12/18/15
to TiddlyWiki
Hi again, JCG,

Mhhh, looks like I just replaced one bug with the next.
(And yes, I need to get into the habit of writing tests).

Hold off with 0.5.2 for a second, I'm working on it.

Best wishes,

Tobias.

Tobias Beer

unread,
Dec 18, 2015, 9:03:42 AM12/18/15
to TiddlyWiki
Ok, so now...

I released version 0.5.3. Get it at the usual place:


It fixes the above mentioned bug and introduces a way to join the filter output like so:

joins the titles with a joiner

<$setvars foo="[bar[2,3][][ - ]]" _bar="[[a b]][[c d]][[e f]]">
<<foo>>
</$setvars>

c d - e f 

Best wishes,

Tobias.

ParisWiki

unread,
Dec 18, 2015, 10:18:53 AM12/18/15
to TiddlyWiki
Thank you Tobias,

Yes, version 0.5.3 works fine.

Of course it could become heavy when the majority of data bits are just a letter, a number, an empty string or a word and just a few are sentences:

[[1]] [[02]] [[z]] [[en]] [[0099]] [[exact]] [[11111]] [[0]] [[]] [[1]] [[Alma Marceau]] [[Saint Michel]]


I was expecting more a "CSV" chain : 1;02;en;exact;11111;0;;1;Alma Marceau;Saint Michel

But I will survive ;-)

Thanks again,

Regards
JCG

Tobias Beer

unread,
Dec 18, 2015, 11:29:35 AM12/18/15
to TiddlyWiki
Hi JCG,
 
I was expecting more a "CSV" chain
But I will survive ;-)

One of these days you'll have to show what you're actually doing. :D

Best wishes,

Tobias. 

Tobias Beer

unread,
Dec 30, 2015, 6:54:44 AM12/30/15
to TiddlyWiki
Hi JCG,

Since you mentioned testing tobibeer/split and perhaps are using it,
please note that version 0.7.0 — as announced and explained here — 
introduces some mild backwards-incompatibility.

Best wishes,

Tobias.
Reply all
Reply to author
Forward
0 new messages