While Jed and Tony gave great examples, I add the below code as an
alternative method to simulate if-clause.
\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
Examples
<<polymorph "Hi">>
<<polymorph input:"Hello">>
<<polymorph input:"Hola" "b">>
<<polymorph input:"Hola" cond:"b">>
And outputs:
This is Macro *A*: Hi
This is Macro *A*: Hello
This is Macro *B*: Hola
This is Macro *B*: Hola
Anyway I saw in TW5.18.1pr some new operators such as range, and contains
have been added, I hope developers specially Jeremy consider adding more
programming capabilities among them are the IF-Clause into the core!
Cheers
Mohammad
--
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 [email protected].
To post to this group, send email to [email protected].
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/bd704550-9735-4b20-a6cc-c40c320cd03c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.