|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--freemarker.ext.misc.Perl5Substitute
Perform Perl 5 substitutions using the Jakarta ORO regular expression library. A list of regular expressions is passed in, and executed in order on a line-by-line basis. In this respect, the Perl 5 modifiers "m" and "s" make no difference here.
Usage:
From java:
TemplateModelRoot root = new SimpleHash(); root.put( "substitute", freemarker.ext.misc.Perl5Substitute.getInstance() ); ...
From your FM-Classic template:
The following is stripped of HTML tags: <transform substitute( "s/<[^>]*>//g" )> <p>This paragraph has <em>all</em> tags removed.</p> </transform> ...
Note:
Perl5Substitute
is a singleton instance. Use the
getInstance()
method to retrieve instances of this model.
Method Summary | |
TemplateModel |
exec(java.util.List arguments)
Creates a TemplateTransformModel with the specified arguments as regular expressions. |
static Perl5Substitute |
getInstance()
Return a new instance of this class. |
boolean |
isEmpty()
Is the object empty? |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static Perl5Substitute getInstance()
public boolean isEmpty() throws TemplateModelException
isEmpty
in interface TemplateModel
true
if this object is empty, otherwise false
public TemplateModel exec(java.util.List arguments) throws TemplateModelException
List
of
String
objects. Each regular expression is evaluated
in order, once per line.exec
in interface TemplateMethodModel
arguments
- a List
of String
objects
containing the regular expressions to be appliedTemplateTransformModel
produced by the method
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |