<$checkbox checked='show' unchecked='hide' field='show_image'>Show Image</$checkbox>
<$reveal type='match' state='!!show_image' text='show'>Put your image here</$reveal>
Filters can be used as if tests. The nicest version is when testing the value of a field.
For example if you had a field called display-code with the value yes or no, you can do this for the current tiddler;
<$list filter="[is[current]display-code[yes]" variable=null>
Do or display what is here eg the code
By setting the variable the current tiddler remains the tiddler it is in so {{!!fieldname}} works
</$list>
There if solutions out there, see evans plugins, personaly I find more value in using filters.
The setwidget can compute filters as well and tge reveal widget can also make comparisons.
Regards
Toby
The else is a filter
[is[current]!display-code[yes]]
Good if no value set.
Or
[is[current]display-code[no]]
Regards
Tony
\define _maca(x) This is Macro ''A'': $x$
\define _macb(y) This is Macro ''B'': $y$
\define polymorph(input, cond:"a")
<$reveal type="match" text=$cond$ default="a")>
<<_maca $input$>>
</$reveal>
<$reveal type="match" text=$cond$ default="b")>
<<_macb $input$>>
</$reveal>
\end
<<polymorph "Hi">>
<<polymorph input:"Hello" "a">>
<<polymorph input:"Hola" "b">>
<<polymorph input:"Hola" cond:"b">>
This is Macro A: Hi
This is Macro A: Hello
This is Macro B: Hola
This is Macro B: Hola
Very good example Tony, I used your point and wrote something like this
<$list filter="[is[current]my-field[true]]" variable=null>
Show the true part!
</$list>
<$list filter="[is[current]!my-field[true]]" variable=null>
Show the false part!
</$list>
\define action-yes()
Yes
\end
\define action-no()
No
\end
<$list filter="[go[yes]]" emptyMessage=<<action-no>> ><<action-yes>></$list><$list filter="[fields[]prefix[menu-]limit[1]]" emptyMessage=<<action-no>> ><<action-yes>></$list><$list filter="[is[current]fields[]prefix[menu-]limit[1]]" emptyMessage=<<action-no>> ><<action-yes>></$list><$if "[go[yes]]" then=<<action-yes>> else=<<action-no>>/> <!--THIS IS A FICTION-->