On Wednesday, May 13, 2020 at 12:04:43 PM UTC-7, Scott Sauyet wrote:
>
> I'm hoping to do that conditionally with something that works like this:
>
> <h2 class="tc-title">
> <if field caption exists><then><$view field="caption"/></then><else><$view 
> field="title"/></else></if>
> </h2>
>
> Obviously the syntax is nowhere near real, but I think it should 
> demonstrate what I'm trying to do.  Is this readily achievable?
>

The above functionality is already built into the <$view> widget:

in the documentation (https://tiddlywiki.com/#ViewWidget) it says:

*The content of the <$view> widget is displayed if the field or property is 
missing or empty.*

Thus, you would write something like this:
<$view field="caption"><$view field="title" /></$view>

Note how the outer $view widget has a matching /$view, and the inner $view 
widget uses the "short form" with the "/>" ending.

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/a99945f0-bb6f-42c8-9fcb-a6a1aa08532f%40googlegroups.com.

Reply via email to