[pmwiki-devel] Testing empty string (was:php logic question)

christian.ridderstrom at gmail.com christian.ridderstrom at gmail.com
Wed Mar 14 08:20:06 CDT 2007


On Wed, 14 Mar 2007, Patrick R. Michaud wrote:

> What would we do with...?
>
>    (:if ! name HomePage:)
>    foo
>    (:elseif "":)
>    bar
>    (:else:)
>    baz
>    (:if:)
>
> PmWiki won't even discover the syntax error on pages with a name other 
> than "HomePage", so what should it render in this case?

If PmWiki had parse the entire conditional construct, it could have 
detected the syntax error. As it is, it's not solveable I guess...

Cute example btw. I don't think the current solution (interpreting it as 
true) is much better though...

>> Here's another thought regarding syntax errors and warnings.
>>
>> What if each error/warning was appended to some variable, e.g. 
>> $PmWikiErrors and $PmWikiWarnings, which you could then optionally show 
>> at the end of the page if you so desire.
>
> Somehow I think it's much better to have warnings displayed as they 
> occur in the markup, rather than save them to the end and try to remap 
> them to their source location.

How about letting that be up to the administrator?

I had another idea though. The warning message for problems about to 
conditional statements could contain a link to the corresponding page in 
the group PmWiki. Same thing could hold for (:pagelist:)

Perhaps every markup rule could have an optional argument specifying the 
warning/error message?

/C

-- 
Christian Ridderström, +46-8-768 39 44               http://www.md.kth.se/~chr


More information about the pmwiki-devel mailing list