[Pmwiki-users] Re: SingleWikiWords implementation

Thomas -Balu- Walter list+pmwiki-users
Thu May 6 09:48:23 CDT 2004


On Thu, May 06, 2004 at 08:53:57AM -0400, Michael_Paulukonis at divintech.com wrote:
> Lookin' good! fairly easy..if not easier than I had envisioned! The extra 
> [= and ' coding is awkward, but if it's what's needed to make it work, I 
> am not squawking.

It's not needed to make it work, but otherwise te SingleWikiWords will
get parsed just like any other page and all the words are substituted.

You do not have to put them around every single word, just around the
complete list.

> One caveat: Once a single-word has been defined, the script uses  any 
> string matching that word--even if the word is PART of a larger string. 

Oh :-) - an easy workaround is to put spaces in the definition:

' PHP ' => '<acronym title="PHP Hypertext Preprocessor">PHP</acronym>'

But this should only be a workaround and is fixed below.  
Or is it interesting to also replace part of words? (PHP-Script)

> Is there any way to make the script stop after the listed characters? ie 
> "Sand" will not effect "Sands" or "Sandwiches" or "SandBox" unless there 
> are wildcards specifically inputted into the SingleWikiWords list?

The used $DoubleBrackets make a difference between simple strings and
regular expressions (starting with '/') - so my script now does the
same:

If 'searchstring' starts and ends with '/' it will be taken as a regular
expression. Otherwise word boundaries will be put around it to make
it only search for these words and not e.g. substrings.

WARNING: The SingleWikiWords feature uses $DoubleBrackets to do the
replacements. Visitors can change the behaviour of your Wiki this way or
even make it stop working. An idea is to make the SingleWikiWords-page
only editable by trusted users and have a
SingleWikiWordsSuggestions-page for suggestions by visitors.

http://www.b-a-l-u.de/index.php/Projects/SingleWikiWords

I am not sure after my quickshot last night if this is how it should
work. E.g. you might change parts of freelinks or similar using the
script and end in undefined behaviour.

     Balu



More information about the pmwiki-users mailing list