Conditional View: transclusion/view and caption field is empty or has wikitext

64 views
Skip to first unread message

Mohammad

unread,
Mar 13, 2020, 2:44:16 PM3/13/20
to TiddlyWiki
Consider a $list like below lists tiddlers tagged with xx with their caption, if not present with their title

<$list filter="[tag[xx]]" >
<li>
<$link to=<<currentTiddler>> tooltip=<<currentTiddler>>>
<$transclude field=caption>
   <$view field=title/>
</$transclude>
</$link>
</li>
</$list>


Assume we have two tiddlers tagged with xx as below:
tidA has an empty caption filed

title: tidA
tag
: xx
caption
:      


title
: tidB
tag
: xx
caption
: {{myTiddler}}


title
: tidC
tag
: xx


where myTiddler has no text filed.

Except for tiddler tidC, other cases shows empty or no value!

What do you think? What solution do you propose?

--Mohammad

Mark S.

unread,
Mar 13, 2020, 4:13:57 PM3/13/20
to TiddlyWiki
b + c worked OK for me. I think you'll need the reveal widget:

<$list filter="[tag[xx]]" >
<li>
<$link to=<
<currentTiddler>> tooltip=<<currentTiddler>
>>
<$reveal stateTitle=<
<currentTiddler>> stateField=caption type="nomatch" text="">
<$transclude field="caption"/>
 </$reveal>
<$reveal stateTitle=<
<currentTiddler>> stateField=caption type="match" text="">
<$view field="title"/>
 </$reveal>

</$link>
</li>
</$list>


Mohammad

unread,
Mar 13, 2020, 4:37:28 PM3/13/20
to TiddlyWiki
Thanks Mark,
 but tidB does not work.
Its caption field is {{myTiddler}}

There is myTiddler with empty text field.

--Mohammad

Mark S.

unread,
Mar 13, 2020, 5:35:26 PM3/13/20
to TiddlyWiki
Sure you populated "myTiddler" ? Works for me ...

Mohammad

unread,
Mar 13, 2020, 11:37:58 PM3/13/20
to TiddlyWiki
So, what does it show: the title: tidB?

Mark S.

unread,
Mar 13, 2020, 11:55:56 PM3/13/20
to TiddlyWiki
Does my screenshot not show up in your mail?

tidB shows the content of the tiddler, mytiddler, which is referenced by {{myTiddler}} in the caption field of tidB.

See attached json.
tw-conditional-view.json

Mohammad

unread,
Mar 14, 2020, 12:40:11 AM3/14/20
to TiddlyWiki
Hi Mark!


On Saturday, March 14, 2020 at 7:25:56 AM UTC+3:30, Mark S. wrote:
Does my screenshot not show up in your mail?

No! 

tidB shows the content of the tiddler, mytiddler, which is referenced by {{myTiddler}} in the caption field of tidB.

See attached json.



Thank you! I got it. It works if myTiddler text field is populated! In my original post myTiddler text field is empty! That is I could not reproduce your results.
When I populate myTiddler text field then it works as you posted.

Many thanks Mark!
Reply all
Reply to author
Forward
0 new messages