[pmwiki-devel] Testing empty string (was:php logic question)
Patrick R. Michaud
pmichaud at pobox.com
Wed Mar 14 08:41:50 CDT 2007
On Wed, Mar 14, 2007 at 02:20:06PM +0100, christian.ridderstrom at gmail.com wrote:
> >>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?
Leaving this as an administrative option means we effectively
have to write *both* versions of the code -- one to display
inline and one to save messages until the end. Ick. It's already
enough of a pain to be doing one, much less both.
> 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:)
It could, although (:pagelist:) doesn't really have "errors"
in the way you're suggesting here. And some sites don't have the
corresponding PmWiki.* pages loaded. And some sites aren't in
English. :-)
Also, I notice you're treating the various problems as being
"syntax errors", when technically they aren't problems in syntax.
For example, the markup
(:if "":)
is perfectly valid PmWiki syntax -- the problem is that there's
no condition named "". It's the same as an author writing
(:if foobar:) -- the syntax is valid, it's just that "foobar"
isn't a defined condition.
Similarly, for
(:pagelist link=Test.Page1,Test.Page2:)
the problem isn't really one of syntax, it's that PmWiki
doesn't understand the multiple dots in the pagename
"Test.Page1,Test.Page2", and thus is returning a value of "".
(Remove one of the dots and you'll see the "problem" go away.)
Yes, this is likely a bug, but if we're going to update the
handling of the link= parameter anyway it doesn't seem to be
worth addressing.
> Perhaps every markup rule could have an optional argument specifying the
> warning/error message?
This seems to assume that the "errors" that occur are all
syntax related -- it also seems to assume that every markup rule
has only one associated error or warning. Many markups have
multiple warnings that can arise -- (:include:) comes quickly to
mind, but there are others. Even in the case of argument handling
to (:pagelist:) there could be a variety of "errors" that occur.
Pm
More information about the pmwiki-devel
mailing list