create new tag
, view all tags

Back to Plugin Home

Text Formatters

  • Please set this variable to prevent system crash from this page. See section "How it work".


Text formatters is engine for text formating syntax. This may format the TWiki page as you defined. For example, you can define regular expression and set CSS style for it, or font properties, or coloring etc.

Syntax of definition

To define you custom formatter you must define on TWiki topic (or on included topic) follow tags:

   # Comment string
   # This variable used for define how find the text to substitune
   REGEXP = (matchString)
   REGEXPIGNORECASE = true | false
   REGEXPMULTILINE = true | false
   # This variable used for substitution mached text
   SUBSTITUTION= <font color="red">$1</font>
   # This variable show how formatter may be overlapped
   # by other formatters
   ALLOWOVERLAP = true | false
   # This variable show how formatter be loaded on TWiki page
   LOAD = auto | manual

  • id - The identity of formatter. Each formatter must have this one, it allow to turn on/off formatter per Twiki topic. See variable LOAD and commands LOAD and DISABLE.
  • Sing # - this is line comment, may used for descriptions.
  • REGEXP - The main regular expression, with this regular expression TWiki page will matched and formatted. See perlre man page for more information about Regular Expressinons or RegularExpressions.
  • REGEXPIGNORECASE - May be true or false. Default false. This flag signaling regular expressing to ignore case while matching.
  • REGEXPMULTILINE - Maybe be true or false. Default true. This flag show how lines are matched - by one line or by set of lines. If this flag is true, then matching proccessing per each line, otherwise, all text mathed as one line.
  • SUBSTITUTION - This is HTML code or just text for replacing matched by REGEXP text. You can use $1, $2, $3 ... etc sings in this variable. See perlre man page for more information about Regular Expressinons.
  • ALLOWOVERLAP - May be true or false. Default is true. Allow or deny overlapping for nested formatters. For example, if for formatter A this set to true, and for formatters B set to false, that if formatter A first replace text to one HTML, then formatter B replace the same on nested of replaced by A text - it allow, but if formatter C replace text nested to replaced by formatter B, it's will disabled.


  • LOAD - May be auto or manual. Default is auto. This flag show how formatted may used, if it auto, then formatter load automaticaly to all TWiki pages, otherwize you can insert %FORMAT:LOAD("id")% to loading formatter on page.


The PhantomPlugin automaticaly replace text and you can see that. To define formatters, please, define it only in this PhantomPluginFormatters topic.

Formatters loading

If variable LOAD set to auto, then formatters automaticaly loaded into all Twiki pages. You can use follow commands:

  • FORMAT:LOAD{"id"}, this command load given formatted by id into page. Significan for formatters with LOAD setted to manual. Example:

  • FORMAT:DISABLE{"id"}, this command disable given formatted by id on page. Significan for formatters with LOAD setted to auto. Example:

How to debug

Sometimes formatter not work. This mean that you maybe wrong in REGEXP. You can set DEBUG flag in PhantomPlugin to 1 and see to data/debug.txt log for errors. List of all replacers avaible in topic you can also see in this log file.

-- AlexeyEfimov - 17 Nov 2002

Topic revision: r1 - 2002-11-20 - AlexeyEfimov
  • 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-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.