On Sunday, June 21, 2020 at 5:48:59 PM UTC-7, Damon Pritchett wrote:
>
> Pretty quick question from someone who knows just enough to do something 
> stupid. I'm starting down the road of having tiddler titles in custom 
> fields with the square brackets around the title so the field turns into a 
> link when displayed. Before I go too far down this path, I'd like to know 
> if this is a path fraught with peril. Is there a reason I shouldn't be 
> doing this and, if so, is there a better way to do it? I've started down 
> that road because I want to use fields instead of tags so that the number 
> of tags doesn't get too large.
>

If the field value is just a single tiddler title, I'd skip putting in the 
square brackets, since they might get in the way later on if you want to 
pass the field value as a parameter to a widget or use it in a filter.

For example:
<$action-setfield $tiddler={{!!somefield}} text="foobar" />
or
<$list filter="[tag{!!somefield}}]">...</$list>

In both of these cases, if the square brackets were already part of the 
field value, then you wouldn't get the results you'd expect.
The first case would write to a tiddler that has literal square brackets in 
it's title, and the second case would look for a tag that had
square brackets in the tag value.

In any case, to make a link from a field value is pretty easy.  All of the 
following will work:
<$link to={{!!somefield}}><$text text={{!!somefield}}/></$link>
or
<$tiddler tiddler={{!!somefield}}><$link/></$tiddler>
or even
{{{ [{!!somefield}] }}}

enjoy,
-e

-- 
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/e8a36aad-91fd-4cb0-8db0-a8788b892870o%40googlegroups.com.

Reply via email to