create new tag
, view all tags
Just a reminder for myself for a generic string replacement plugin ...

Rationale: put formatting rules in an editable topic (let call it WebPatterns and TWikiPatterns)


  • at plugin initialization:
    • collect all patterns from the topics (first TWikiPatterns, then WebPatterns)
    • avoid overriding patterns ( a' la FINALPREFERENCES )
    • compile them as pattern variables
    • if needed, for the efficiency-concerned, compile at runtime a subroutine that does all replacements
  • Instantiate a Safe container (see the Safe CPAN module) enabling some TWiki functions and vars:
    • &internalLink(), %handleIncludeFile() ...
    • $web, $topic, $username ...
  • in the outsidePreHandler apply (eval) the replacements inside the Safe container

Desirable side effects:

  • if the pattern specification is verbose enough we obtain automagically its documentation


  • Double underscore -> bold italic
  • Old syntax of INCLUDE tag:
    • Pattern OldIncludePattern = /%INCLUDE:"([^%\"]*?)"%/&handleIncludeFile( $1, $topic, $web, $user )/geo

PS: I have used WikiNames for patterns so that we can document their syntax and examples

-- AndreaSterbini - 20 Feb 2001

I'm almost done with a dumb version of the above idea, you can just define patterns with the syntax

  • Replace <pattern> with <replacement>
  • the pattern is a normal regexp
  • the replacement is just a string where the symbols $1 .. $9 are replaced with the corresponding matching parts in the pattern.

-- AndreaSterbini - 21 Mar 2001

moved here from elsewhere by MattWilkie on 07 June 2004:

[...] will allow a corporation to enforce language censorship rules on a TWiki server. You could also, in theory, use it to squash those people that have a fondness for using stupid buzzwords smile It will convert these words into "garbage" characters (I might add an "image" option at a later date, to give it some colorful coolness).

Syntax Rules

  • No tags

GenericReplacerPluginDev Settings

  • List of bad words
    • Set BADWORDS = synergy, utilization, harmonize

-- DavidWeller - 16 Dec 2001

in the meantime you could just use SmiliesPlugin to obtain almost the same goal smile

-- AndreaSterbini - 18 Dec 2001

Can we do something like this?

userinfo(user1, address, phone_no)
userinfo(user2, address, phone_no)
i.e. much cleaner way to specify tables etc. and manage its style from one single location (i.e. where pattern is defined).

In essence, a mechanism that would allow us to use arguments to be inserted in a template. This means, the pattern replacement text should be a block of multiple lines. Is this useful?

-- VinodKulkarni - 08 Jun 2004

Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r7 - 2004-06-08 - VinodKulkarni
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.