We've already got facilities for conditional rendering via the reveal and list widget; we may need to extend them but they've been sufficient so far.
The proposal here is for macro definitions that include conditional elements. It's important that we implement this at the right layer. Using the <$reveal> widget as suggested by Stephan in another thread has the disadvantage of incurring a rendering penalty. Ideally, we'd incorporate the new conditional syntax in the macro definition syntax. The simplest proposal is for new \ifdef and \ifndef pragmas: \define myMacro(param) \ifdef param The parameter is defined as $param$ \else The parameter is not defined \endif \end That syntax has the benefit of great simplicity. Tobias's original example could be done like this: \define myMacro(param) \ifdef param <$set name="myvariable" value="""$param$"""> \else <$set name="myvariable" value=<<myDefaultValue>>> \endif The value of myvariable is <<myvariable>> </$set> What do you think? Best wishes Jeremy On Sun, Nov 23, 2014 at 7:36 PM, Stephan Hradek <[email protected]> wrote: > First problem first including pseudo code: > > \define macro(foo) > <!-- if $foo$ ; begin --><$reveal type="nomatch" state=" non existing > tiddlre " text="$foo$"> > do this > <!-- end --></$reveal> > <!-- else ; begin --><$reveal type="match" state=" non existing tiddlre " > text="$foo$"> > <!-- if <<foo>> ; begin --><$reveal type="nomatch" state=" non > existing tiddlre " text="$(foo)$"> > do that > <!-- end --></$reveal> > <!-- else ; begin --><$reveal type="match" state=" non existing > tiddlre " text="$(foo)$"> > otherwise this > <!-- end --></$reveal> > <!-- end --></$reveal> > \end > > ! No Param, No Var > > <<macro>> > > ! Param, No Var > > <<macro "foo param">> > > <$set name="foo" value="foo var"> > > ! No Param, Var > > <<macro>> > > ! Param, Var > > <<macro "foo param">> > > > > Note: Despite the fact that I used blanks as first and las character in > the stet tiddler's name, this does not keep help the " non existing tiddler > " from being created as the state tiddler's name gets trimmed by > tiddlywiki. So the whole logic will fail as soon as you have a non-empty > tiddler called "non existing tiddler". > > -- > 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 http://groups.google.com/group/tiddlywiki. > For more options, visit https://groups.google.com/d/optout. > -- Jeremy Ruston mailto:[email protected] -- 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 http://groups.google.com/group/tiddlywiki. For more options, visit https://groups.google.com/d/optout.

