Good day,

Triggered by the announcement of Tamasha I decided to dig into TW5 some 
more. Therefore I created a --javascript free -- plugin for easy import and 
display of spreadsheet data, or more generally dataframes. Along the way I 
ran into some subtleties / miscomprehensions of the tiddlywiki framework , 
which might be of interest to others. A demonstration of the dataframe 
plugin and  a working description of three subtleties in action is 
available at: https://hwvandijk.bitbucket.io/tw-dataframe/

1. splitregexp that crashes the Javascript engine of Firefox 58, but works 
on tiddlydesktop 0.14 (chromedriver 81)
I used a (elaborate) regular expression in splitregexp to split "ABC123" in 
to "123 ABC" in one go. 
i.e.
regexp="([A-Z]+(?=[0-9]+))|([0-9]+(?=[A-Z]+))"  
and filter="[<ref>splitregexp<regexp>reverse[]]"

I get a Javascript error: *uncaught exception: Linked List only accepts 
string values, not undefined *
The problem has been solved by using a more straightforward regular 
expression in a  search-replace:regexp filter operator.

2. $x$ and <<__x__>> or similar but not identical
I had problems using macro parameters in filters. Therefor I cast them in a 
<$set> or <$vars> variable, either through $x$ or <<__x__>>. The former 
works fine unless a parameter x that is passed to the macro contains 
slashes.
<<mymacro one.2.three> works fine, <<mymacro one/2/three>> fails. It 
renders the <$vars expression> literally in the page.

3. <$set filter:"filter" variable="var"> and <$vars var={{{ filter }}}> 
give different results
To specify the index/columns of the dataframe  to be displayed I use a list 
of ranges. Meaning that a spec of "1,3-5,7" should be transformed into "1,1 
3,5 7,7" such that when you feed these entries one by one into the range 
operator you get [1 2 3 4 5 7]. 
However with:

<$vars p=<<__param__>> 
      regexp="^(\d+)$" > 
<$set name="setref" 
filter="[<p>split[,]search-replace:g:regexp<regexp>,[$1,$1]]" >
<$vars varsref={{{ [<p>split[,]search-replace:g:regexp<regexp>,[$1,$1]] }}} 
>

The variables *setref* and *varsref* are not identical. *varsref* is wrong, 
you should use *setref*.
varsref only works for simple specifications, such as "7". It looks like 
*varsref 
*does not obey the g (global) specifier.
 
Sorry for the long mail, but hopefully someone can point out my 
misconceptions or file a bug if that is appropriate.

Cheers,

Hylke van Dijk



-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/d3c39f37-3582-4002-92fe-7d11176057e9n%40googlegroups.com.

Reply via email to