FilterPlugin

This plugin allows to substitute and extract information from content by using regular expressions.

Syntax Rules

Tag Description
%SUBST{topic="..." parameters }% insert a topic by processing its content
%STARTSUBST{ parameters }% ... %STOPSUBST% process text given inline
%EXTRACT{ parameters }% extract text from a topic
%STARTEXTRACT{ parameters }% ... %STOPEXTRACT% extract content given inline

Parameter Description
topic="..." name of the topic text to be processed
pattern="..." pattern to be extracted or substituted
format="..." format expression or pattern substitute
hits="<n>" number of occurences to extract or substitute counted from the start of the text (defaults to 0 aka all hits)
expand="on,off" toggle on/off expansion of TWiki markup before filtering (defaults to on)

Examples

Secure Html

%STARTSUBST{pattern="<(a href=\"javascript:.*?)>(.*?)" format="<$1>$2</a>"}% Pop me up %STOPSUBST%

Format Comments

Date Author Headline
%EXTRACT{topic="FilterPlugin" expand="off" pattern=".div class=\"text\">.*?[\r\n]+(.*?)[\r\n]+(?:.*?[\r\n]+)+?-- (.*?) on (.*?)[\r\n]+" format="| $3 | $2 | $1 ... |\n"}%

This is a first comment. This is a first comment. This is a first comment.
-- TWiki:Main.MichaelDaum on 22 Aug 2005

This is a second comment.
-- TWiki:Main.MichaelDaum on 22 Aug 2005

Plugin Settings

  • Set SHORTDESCRIPTION = Filters content

Plugin Installation Instructions

  • Download the ZIP file from the Plugin web (see below)
  • Unzip FilterPlugin.zip in your twiki installation directory. Content:
    File: Description:
    data/TWiki/FilterPlugin.txt Plugin topic
    data/TWiki/FilterPlugin.txt,v Plugin topic repository
    lib/TWiki/Plugins/FilterPlugin.pm Plugin Perl module
  • Test if the installation was successful:
    • enter samples here

Plugin Info

Plugin Author: TWiki:Main.MichaelDaum
Plugin Version: 22 Aug 2005 (v0.91)
Change History:  
22 Aug 2005: Initial version
  added expand toggle
TWiki Dependency: $TWiki::Plugins::VERSION 1.024
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005
License: GPL (GNU General Public License)
TWiki:Plugins/Benchmark: GoodStyle nn%, FormattedSearch nn%, FilterPlugin nn%
Plugin Home: TWiki:Plugins/FilterPlugin
Feedback: TWiki:Plugins/FilterPluginDev
Appraisal: TWiki:Plugins/FilterPluginAppraisal

-- TWiki:Main.MichaelDaum - 22 Aug 2005

Navigation

%IFSKINSTATETHEN{searchbox="pos2"}%

%FISKINSTATE%
%MYSIDEBAR%

 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback