[pmwiki-users] Re: Include bug or feature

Patrick R. Michaud pmichaud at pobox.com
Thu Feb 3 15:06:32 CST 2005


On Wed, Feb 02, 2005 at 10:50:50PM +0100, chr at home.se wrote:
> On Wed, 2 Feb 2005, Patrick R. Michaud wrote:
> 
> > No, that's controlled by the $MaxIncludes variable.  I seem to recall
> > it had something to do with dealing with invalid (:include:) syntax,
> > as in:
> > 
> >    (:include !@$ lines=10:)
> > 
> > IIRC the problem is the conversion of the "!@$" in the above becomes
> > the current page, which leads to bizarre things, and I was trying to
> > avoid that without requiring the second argument to be a perfectly
> > formatted pagename.
> 
> Eh.. why does '!@$' translate to the current page? Is it because the 
> regexp evalues the match or something?

Whatever comes after the "include" is passed to MakePageName() to be
converted into a valid pagename.  If there aren't any valid pagename
characters, MakePageName tends to return the current page.  (At least,
it did at one time -- I don't know if it still works this way.)

Thus for "Main.SomePage" the statement

    (:include !@$:)

gets treated as

    (:include Main.SomePage:)

which builds a recursive include that the author probably didn't intend.  
However, maybe the real solution is to solve this by requiring the thing 
following "include" to begin with a letter or a digit, since there's 
not anything else that would constitute a valid pagename.

Pm



More information about the pmwiki-users mailing list