[pmwiki-users] {(...)} markup recipe available

Patrick R. Michaud pmichaud at pobox.com
Wed Apr 11 13:22:20 CDT 2007


On Wed, Apr 11, 2007 at 12:53:40PM -0500, Ben Stallings wrote:
> With some tweaking of the Markup definitions, this recipe might be able 
> to coexist peacefully with the existing {( ? : )} ternary logic markup 
> used in SelectQuery for the past year.  Or a variant of that markup, 
> compatible with PmWiki's conditionals, could be included in 
> MarkupExpressions.  I envision something like,
> 
> Christmas is {(gt 2007-12-25 (ftime "%F" now) ? coming! : past!)}

It may need some serious tweaking, because {(...)} always
expects the operation to be at the front, while {( ? : )} seems
to have its operators in the middle.  If I were doing this
from scratch, I would probably write it as:

  {(if cond true false)}

Then the above would be written as:

  Christmas is {(if (gt 2007-12-25 (ftime %F)) "coming!" "past!")}

> Would that be useful?  Or should SelectQuery try to phase out its 
> ternary markup to avoid confusion with the new recipe?  --Ben

I didn't realize that SelectQuery was using {(...)} as a 
markup sequence, so my profound apologies if this development 
is now clobbering that.  I think I would head towards the 
{(if ...)} approach -- I think it's slightly less cryptic,
and we also don't have to worry about " ? " and " : " accidentally
appearing in the text somewhere as the result of another substitution.

But whatever you choose to do is great with me, and if I can
help resolve any conflicts, let me know.

Pm



More information about the pmwiki-users mailing list