[pmwiki-users] Pagename alternative conflicts? was Re: Wikipaths
Patrick R. Michaud
pmichaud at pobox.com
Fri Sep 8 09:07:48 CDT 2006
On Fri, Sep 08, 2006 at 09:52:06AM -0400, Crisses wrote:
> On Sep 8, 2006, at 8:48 AM, Patrick R. Michaud wrote:
> >Still, I can't think of anything currently in PmWiki that will
> >specifically disallow the colon in pagenames, if one is willing to
> >accept that there may be conflicts with url protocol prefixes and
> >InterMap prefixes.
> Can the intermap delimiter be changed? LOL
Actually, it can, with a couple of small modifications. :-)
> >allow colons, and get MakePageName() to not strip colons in the
> >pagename. So, in config.php:
> > $NamePattern = '[[:upper:]\\d][\\w:]*(?:-[\\w:]+)*';
> > $PageNameChars = '-:[:alnum:]';
> It's not working. I personally prefer perl (PCRE) over posix (PREG)
These *are* PCRE regexes -- that's basically all I use.
The preg_* functions in PHP use PCRE.
> In posix regex, : does not seem to need to be escaped, but your
> regexes didn't work.
Odd, they're working for me.
> I know the regexes you hinted at are (not) working because I managed
> to break them while tweaking to see if I could fix them.
> Original pmwiki.php line
> //pmwiki.php:43:$NamePattern = '[[:upper:]\\d][\\w]*(?:-\\w+)*';
> $NamePattern = '[[:upper:]\\d][\\w]*(?:-[\\w:]+)*';
> $PageNameChars = '-:[:alnum:]';
This version of $NamePattern is saying that colons can only appear
> I tried
> $NamePattern = '[[:upper:]\\d][\\w]*(?:-[\\w]+[:]+)*';
This is saying that colons can only occur after hyphens, and then
only if at the end of the pagename or immediately followed by a hyphen. :-)
> and that failed also.
> blew up with fireworks
Yes, because the hyphen is no longer treated as a hyphen but as
a range character. $PageNameChars gets embedded in a pcre
"[^...]" sequence, to identify the characters that are *not*
allowed in a pagename. Thus it's the difference between
[^-:[:alnum:]] and [^:-[:alnum:]]
In the first, the hyphen means "don't match a hyphen", in the
second it means "don't match any character between colon and ["
(which would really blow up with fireworks, indeed).
At any rate, I'm curious as to why the versions I supplied aren't
working for you -- is there a url I can look at? Or perhaps
try it on a clean install w/no recipes?
More information about the pmwiki-users