Thank you, c pa, for reviewing my solution and suggesting an alternative! 
Your version resembles my first try (TextStretch 0.7.1) in many ways. Let 
me point out some differences: 

1) Using the $id$ supplied by the user makes this parameter mandatory for 
many cases. As soon as you have two or more stretch elements you *must* 
define a unique id, else all elements will open and close at the same time. 
I wanted to generate an id, if it is not specified by the user: 

<$set name="uid" filter="[<id>!prefix[_false_]]" value=<<id>> emptyValue=<
<content>> >

If no id was set by the user, my default "_false_" is used => I assign the 
content value as the new id. This already works, but the state tiddler 
titles can get very long when the whole text-content ist appended. This is 
not only ugly, it also blows up the size of your wiki. This is why I 
generate a hash number over the text: 

<$set name="xuid" filter="[<uid>prefix[_false_]]" value="error: xuid 
hashing" emptyValue=<<HashStr """$uid$""">> >

By the way, the instruction to import the HashStr-macro is already in my 
docs: 
"Drag the links from the following list to your Wiki, save and *reload*." 
The link to the 

   - macro for hashing: $:/_telmiger/utils/HashStr.js 

is in the list. Should I emphasize the reload part?

(Maybe there is a better solution to call the core function 
$tw.utils.hashString(str); ? – to call it from my own js-macro was the only 
one I found.)


2) The reason, why I use <$set name="var" value="""$var$"""> a lot is this: 
I had some problems with $content$ containing/surrounded by "" or ' and try 
to sanitize it by putting it between """three quotation marks""" on each 
side. I copied this from Mat’s solution, actually. When I have the time, I 
will do further testing, if they all are needed.

Thanks again for your feedback – this is highly appreciated – and good 
night!
Thomas

-- 
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/6f1979a6-f472-46b7-9cac-c1ef95a0d593%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to