[Pmwiki-users] Re: calculating directives ?
Fri Jun 18 19:20:38 CDT 2004
Knut, I did not adapt the syntax. My code does this markup:
?formula? prints result of formula (and stores it in ?$?)
?formula=$var? prints the *formula* and stores result in $var
?$var? prints $var
It allows you to do something like:
Contributions total (?11.10 * 10=$?) = M$?$?
Contributions total M$?11.10 * 10?
and have it printed as:
Contributions total (11.10 * 10) = M$111.00
Contributions total M$111.00
Most math functions are supported, including the very useful round(). Any
other function is easily added.
However it does not do this, I didn't get to this:
You know ?1=$a?+?1=$b? is ?$a+$b?
to print as
You know 1+1 is 2
Which is obviously the kind of app you want.
# inline calculations with var storage:
# ?formula? ?formula=$var? and ?$var?
---- Original Message ----
> Knut, I published some formula-evaluation code before using a
> ((..)) syntax. I made a revision since then to use variables, I'll
> adapt it to your syntax and pass it tomorrow.
> [[calc $var=expression]] to set a variable without displaying the
> result [[show $var=expression]] to set the variable and displaying
> the result in the wikitext
> [[show expression]] incl [[show $var]] to show the result in the
> I thought of evaluating php-functions for the expressions and
> assignments maybe added by some user-written php-functions
More information about the pmwiki-users