[pmwiki-users] Space in WikiWord problem with PITS/00327

Ralph Zeller ralph at zellercpa.com
Wed Jan 25 13:50:28 CST 2006


On 01/25/06 10am, Patrick R. Michaud wrote:
> On Wed, Jan 25, 2006 at 07:40:58AM -0800, Ralph Zeller wrote:
> > Hello,
> > 
> > I'm using pmwiki version 2.1.beta20, and I'm having the problem described
> > in PITS/00327, which is listed as fixed and closed in an earlier version.
> > 
> > I'm using Apache on Linux with PHP v 5.0.4 
> > 
> > Thanks for any help/advice.
> 
> Ah, 2.0.beta30 actually fixed a slightly different problem from
> PITS.00327.  
> 
> Technically the $WikiWordCount variable is intended to only
> control the number of times a particular wikiword is linked, it's
> not intended to change whether or not it gets spaced, or indicate
> that it's no longer treated as a wikiword.
> 
> I suspect the real answer to your problem will be for us to adjust
> the AsSpaced() function, so that it's easier to indicate the spacing
> and capitalization of certain wikiwords.  This would also fix spacing
> in things such as page titles, which $WikiWordCount doesn't have any
> affect on.
> 
> Pm

Thanks, I really like pmwiki!

As reference to anyone with a similar problem, I submit my solution.
I didn't use the "`WikiWord" approach because I'm pulling names from a
database, and I don't want the (`) character to affect the sorting.
I got the result I wanted with the following added to my config.php:

function SoSpaced($text) {
  $text = preg_replace("/([[:lower:]\\d])([[:upper:]])/", '$1 $2', \\
$text);
  $text = preg_replace('/(?<![-\\d])(\\d+( |$))/',' $1',$text);
  $text = preg_replace("/([[:upper:]])([[:upper:]][[:lower:]\\d])/",
    '$1 $2', $text);
  $text = preg_replace('(Mc Donald)', 'McDonald', $text);
  $text = preg_replace('(Mc Coy)',    'McCoy',    $text);
  $text = preg_replace('(Jo Ann)',    'JoAnn',    $text);
  $text = preg_replace('(Mc Kenzie)', 'McKenzie', $text);
  return $text;
}  
$AsSpacedFunction = 'SoSpaced';





More information about the pmwiki-users mailing list