wikify field value when displaying using view widget

187 views
Skip to first unread message

passingby

unread,
Jan 24, 2018, 11:30:23 AM1/24/18
to tiddl...@googlegroups.com
Friends,

I have a template for displaying tiddler's fields in its view mode. The field is named 'people'. and its value contains names of people like lets say john. The template displays the value of the field using this:

<$view field="people" format="plainwikified" mode="block"/>



What I want is to display the field value as a tiddler link, so that I can click on it to go to the tiddler with that person's name. When entering the field value I enter the value in double square brackets like this: [[john]]. I expect that now when the field value is displayed it should be displayed as a link but it does not.

When I the above mentioned format the display is : 

john (with square brackets stripped away and no tiddler link)

When I choose 
<$view field="people" format="htmlwikified" mode="block"/>

it shows up as : 

<p><a class="tc-tiddlylink tc-tiddlylink-missing" href="#Taminder%20Singh">Taminder Singh</a></p>

which proves that tiddlywiki is definitely seeing the field value as a missing tiddler link.

With 
<$view field="people" format="htmlencodedplainwikified" mode="block"/>

is displayes as:

john (again, square brackets stripped but no tiddler link) 

So whats the way to display a text as wikified as tiddler link? I expected plainwikified to work.

Mark S.

unread,
Jan 24, 2018, 12:08:37 PM1/24/18
to TiddlyWiki
I think the answer is that you want to transclude, not view, the field, like:

<$transclude field="people"/>

or

{{!!people}}

Good luck,
-- Mark

passingby

unread,
Jan 24, 2018, 12:22:51 PM1/24/18
to TiddlyWiki


On Wednesday, January 24, 2018 at 10:08:37 AM UTC-7, Mark S. wrote:
I think the answer is that you want to transclude, not view, the field, like:

<$transclude field="people"/>

or

{{!!people}}

Good luck,
-- Mark

That works! Thank you Mark. But just for understanding, why does the view widget with "plainwikified" format not work?  

Jeremy Ruston

unread,
Jan 24, 2018, 12:51:53 PM1/24/18
to tiddl...@googlegroups.com
Hi PassingBy

That works! Thank you Mark. But just for understanding, why does the view widget with "plainwikified" format not work?  

The common use cases for the view widget are fairly specialised: displaying fields in plain text, and formatting dates. The various encoding and wikified formats are primarily for use in TiddlyWiki’s internal templates.

The “plainwikified” format actually wikifies the argument and then extracts the plain text of the result. So, plainwikified “jeremy” is “jeremy” but plainwikified “<p>jeremy</p>” is still just “jeremy”. That’s almost certainly not what you wanted.

If you want to wikify a field then you should use transclusion, either with the double curly braces shortcut format or with the <$transclude> widget.

If you want to display a field as plain text then you can use the view widget or the text widget. The following are equivalent:

<$text text={{!!myfield}}/>

<$view field="myfield"/>

Best wishes

Jeremy.





--
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+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
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/58a66307-4af2-48dc-bd8c-93531242801a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

passingby

unread,
Jan 24, 2018, 1:33:36 PM1/24/18
to TiddlyWiki
Thank you for the explanation Jeremy.

TonyM

unread,
Jan 24, 2018, 6:42:52 PM1/24/18
to TiddlyWiki
Jeremy,

A suggestion, 

Such advice should be in the ViewWidget tiddler on tiddlywiki.com as I have visited this many times in my learning process to discover it useless for what I wanted to do, alternatively the formats could be extended to support those commonly desired by users.

Regards
Tony  
Reply all
Reply to author
Forward
0 new messages