[Pmwiki-users] Disabling WikiWords

Patrick R. Michaud pmichaud
Wed Feb 11 22:35:09 CST 2004


Proposed 0.6 feature offered for comments, reactions, and suggestions:

I've just added a new feature to the 0.6 beta that makes it easier 
for a WikiAdministrator to:
  * Disable all WikiWords
  * Disable specific WikiWords from becoming links
  * Limit the number of WikiWords that are converted to links (either
    individually or globally)
  * Provide alternate replacement text for specific WikiWords

These features are controlled by three variables.  The first,
$WikiWordCountMax, sets the number of times that each WikiWord 
should be converted into a link.  Thus, setting $WikiWordCountMax=1 
causes only the first occurrence of a WikiWord in a page to be 
converted, $WikiWordCountMax=3 would convert the first three
occurrences of each word, and $WikiWordCountMax=0 disables WikiWords
entirely.

The number of conversions for each WikiWord can also be controlled
individually by the $WikiWordCount array, thus setting 
$WikiWordCount['PmWiki']=5 would cause only the first five instances
of "PmWiki" to be converted to a link, and $WikiWordCount['PhD']=0
would disable "PhD" as a WikiWord.  

To prevent a page from linking to itself via WikiWord links, one 
can do:
   $name = FmtPageName('$Title_',$pagename);
   $WikiWordCount[$name] = 0;

These limits are only imposed for "bare" WikiWords--WikiWords that
are qualified by a group name (Group/WikiWord), appear in a {{FreeLink}},
or appear in double brackets are still treated as links.

Finally, the $WikiWordReplaceFmt array allows special rendering rules
to be associated with individual WikiWords, so the statement
   $WikiWordReplaceFmt['PmWiki'] = '<b>PmWiki</b>';
would cause "PmWiki" to always be rendered in bold (and not a link).
A customization such as:
   $name = FmtPageName('$Title_',$pagename);
   $WikiWordReplaceFmt[$name] = "<b class='selfreference'>$name</b>";
would cause a page to always refer to itself in bold text.

Comments?  Useful, or not?

Pm



More information about the pmwiki-users mailing list