[pmwiki-users] MarkupExpressionsExtensions

The Editor editor at fast.st
Tue Apr 17 06:07:12 CDT 2007


On 4/17/07, Hans <design5 at softflow.co.uk> wrote:
> Tuesday, April 17, 2007, 11:18:57 AM, Petko wrote:
>
> > No, PHP math functions cannot be used (such as round(), sqrt(), abs(), etc.).
> > Yes, just the simplest of arithmetic -- addition, substraction,
> > multiplication, division -- and the expression *must* be written correctly.
>
> Maybe it better be called {(calculate ..)} or ({calc ... )}
> if that is what it does, and not evaluate equations with math
> functions.

That's a possibility, but given MarkupExpressions can be nested, and
it is easy enough to add these functions as needed, it seems probable
the math function could be made to use these functions (even if we
added these definitions right into the extensions recipe).

Another possibility, is to redefine an pattern to allow specific math
functions into the input.  Easy enough to do.

The problem of incorrectly written phrases is a bigger concern as many
are not yet on PHP 5.  Granted, in most cases it is being used by
advanced authors, or more likely an admin setting up some application
requiring math, and who will do the basic debugging. But I think it's
possible a subroutine could be developed that would return '' where
the input is less than ideal.

For example:

1.  Each opening ( could be checked for a closing )
2.  The remaining operators and numbers should alternate.

I can think of some pretty simple ways to do the above. But perhaps a
better coder could work it out in more detail.

Cheers,
Dan



More information about the pmwiki-users mailing list