[pmwiki-users] Pagename alternative conflicts? was Re: Wikipaths

Crisses crisses at kinhost.org
Fri Sep 8 08:52:06 CDT 2006


On Sep 8, 2006, at 8:48 AM, Patrick R. Michaud wrote:

> Hyphen is already allowed.  Colon can be a bit tricky, because of
> things like
>
>     [[SomeGroup.http:subtext]]
>
> which might look like a url to some if "SomeGroup." isn't present.
> And of course, there are the potential conflicts with InterMap links.

That's not a likely pagename on this particular site :)

I knew hyphen is allowed.  The trick is getting the colon in there.

> 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

> There is the (small, shrinking) possibility that we would use
> {PageName:var} instead of {PageName$:var} for text fields, and this
> would of course pose a conflict.

*nods*

> Anyway, to answer the question -- we'd need to adjust $NamePattern to
> 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)  
regexes....

In posix regex, : does not seem to need to be escaped, but your  
regexes didn't work.

I put [[Group/OfMiceAndMen:SteinbeckJohn:HerHairHung]] on a page.   
Click it and it brings me to a "create page screen" where the  
pagename is
Group/OfMiceAndMenSteinbeckJohnHerHairHung

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:]';

I tried
$NamePattern = '[[:upper:]\\d][\\w]*(?:-[\\w]+[:]+)*';
and that failed also.
$PageNameChars=':-[:alnum:]';
blew up with fireworks

and $PageNameChars='-[:alnum:]:';
had no discernible effect

$MakePageNamePatterns = array(
     "/'/" => '',			   # strip single-quotes
     "/[^-:[:alnum:]]+/" => ' ',         # convert everything else to  
space
     "/((^|[^-:\\w])\\w)/e" => "strtoupper('$1')",
     "/ /" => '');
in my config.php didn't help either.  Note I changed the 3rd pattern  
to include the colon (the 2nd I put the $PageNameChars instead of the  
variable, just in case).

So colons are still being turned into spaces/being stripped..

> There are still probably some other things that would have to
> change to make this work, but the above is a pretty good start.
>
>> I noted that MediaWiki uses colons, and in the case of something I'm
>> working on, the colon is preferred over a hyphen to separate terms on
>> the page.
>
> I think that MediaWiki's use of the colon tends to be more like
> PmWiki's wikigroups than a straightforward part of the pagename.
> But I could be wrong about that.  :-)

Yes, but before then I hadn't realized that : was a legal URL  
character aside from http:

Crisses




More information about the pmwiki-users mailing list