[pmwiki-users] Math/Php markup... ZAPbeta 2007-03 tweaks...

Patrick R. Michaud pmichaud at pobox.com
Sun Mar 18 11:18:33 CDT 2007


On Sun, Mar 18, 2007 at 12:26:10AM -0400, The Editor wrote:
> {#c substr|How are you today, 5,3} and get something like "you" back.

Nitpick:  I would hope that this would return "are", not "you".  :-) :-)

Some other thoughts/reactions...

I think I would caution against this particular markup, because it
seems likely to run into some problems.  First, depending on how
you're parsing the string, it would seem that one would run into
difficulty performing operations on strings containing curly
braces or commas.  Instead of the single curly brace closer,
I'd suggest a 2-character closing sequence, such as "#}".

Beyond that, I don't quite see the purpose of the "#c" at
the beginning of the markup.  It seems to me that one could
just as easily do the clearer:

    {#substr How are you today, 5, 3 #}
    {#strftime %Y-%d-%m #}
    {#date#}
    {#time#}
    {#crypt foo#}
    {#math (2+3)*5/2.5 #}

But then this makes me wonder if we really need a new
syntax marker for this, and if we couldn't just use
the (:...:) syntax we already have for selected functions:

    (:substr "How are you today" 5 3:)
    (:strftime %Y-%d-%m:)
    (:date:)
    (:time:)
    (:crypt foo:)
    (:math 2+3*5/2.5 :)

I do admit there seems to be something subtly different
between these functions and what we normally think of as
"directives".  But there's also something to be said with
avoiding the question of "am I supposed to use (:...:)
or {#...#} here?"

It's also the case that we've tended to use curlies
to indicate things that are "inline substitutions" --
page variables come to mind, as well as the various
math markups {$...$}.

I'm also not sure that someone might want to use {#...#}
some day for another purpose, especially since we already
have things like {-...-}, {+...+}, etc.  The '#' character
doesn't read "function" to me.  Perhaps a better syntax
would be something like {(...)}, as in:

    {(substr "How are you today" 5 3)}
    {(strftime %Y-%d-%m)}
    {(date)}
    {(time)}
    {(crypt foo)}
    {(math 2+3*5/2.5 )}

Just some thoughts...

Pm



More information about the pmwiki-users mailing list