[pmwiki-users] MarkupExpressionsExtensions

Patrick R. Michaud pmichaud at pobox.com
Sun Apr 15 16:41:08 CDT 2007


On Sun, Apr 15, 2007 at 01:48:28PM -0400, The Editor wrote:
> >- {(attr title)} allows people to view the title of read-protected
> > pages.  Same with {(attr keywords)} and {(attr description)}.
> > Also, it's not clear why we need these versions of the markup when
> > we already have {$Title} and {$Description} (and could easily add
> > {$Keywords} if that's desirable).
> 
> Good point.  If you would like to add $Keywords (perhaps to core) I
> would just change this to a password function for admins.  Very useful
> for that.

I even think that extracting the password values is better done 
with a page variable than an expression.

> >- I think {(server ...)} really ought to use the actual $_SERVER
> > names instead of introducing its own.  Otherwise authors have
> > to learn a different set of names for things that already have names.
> 
> Perhaps, but an admin that knew enough php to know all the server vars
> would probably just be doing page variables or setting up their own
> local extensions. My position as usual is to help those who don't
> really know php.  

As Dominique correctly points out, this has nothing to do with PHP.  
These are defined by the CGI protocol and come from the apache server
(which is why PHP calls its variable $_SERVER).  

Someone who isn't familiar with PHP is likely to do a web search
for "how do I find the page that the person was on before this one"
and will find 'HTTP_REFERER', not 'return'.  Beyond that, the word
'return' has a lot of meanings other than what it's being used for
here.  (Could it be confused with PHP's 'return' statement?)

> Though Pm is quite good at choosing syntax, I think in general we tend
> to need an advocate on this list for the non programmers who use
> PmWiki.  

By suggesting that we use the actual names, I _am_ advocating for
and thinking of the non-programmers, because when a non-programmer 
does a Google search for things like "how do I find out the user's 
browser?" or "how do I find out the address a user is coming from?", 
that non-programmer is going to find references to HTTP_USER_AGENT
and HTTP_REMOTE_ADDR and not 'browser' or 'ip'.

> If you make the (:: (:pagelist :) ::) change you propose awhile back
> and I can figure out how to make it work in ZAP, I'd be happy to drop
> this.  I put it up deliberately thinking it might end up being a stop
> gap measure.

I've only heard one other comment about the (:: ... ::)
proposal, and that comment was against it as being too cryptic.

> >   if ($p == '') break;
> >   if (!preg_match($ZAPmath, $p)) break;
> 
> Fixed.  

The recipe now seems to have

    if ($p == '') return;
    if (!preg_match($ZAPmath, $p)) return;

which is also somewhat incorrect, because the caller is expecting
a return value.  It really needs to be

    if ($p == '') return '';
    if (!preg_match($ZAPmath, $p)) return '';

Pm



More information about the pmwiki-users mailing list