From 9bcaaaa34eedddac37e3681eb261c8ac600b6555 Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Wed, 12 Nov 2003 09:35:31 +0000 Subject: [PATCH] scriptfilter: clarify getToken and setToken methods, provide another example git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275632 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/CoreTypes/filterchain.html | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/docs/manual/CoreTypes/filterchain.html b/docs/manual/CoreTypes/filterchain.html index 89f26ad4a..332076611 100644 --- a/docs/manual/CoreTypes/filterchain.html +++ b/docs/manual/CoreTypes/filterchain.html @@ -1260,6 +1260,8 @@ an explanation of scripts and dependencies.

The script is provided with an object self that has getToken() and setToken(String) methods. +The getToken() method returns the current token. The setToken(String) +method replaces the current token.

This filter may be used directly within a filterchain.

@@ -1286,16 +1288,30 @@ Must be a supported Apache BSF language

Examples:

-Convert to uppercase. +Convert to uppercase:
 <tokenfilter>
     <scriptfilter language="javascript">
         self.setToken(self.getToken().toUpperCase());
     </scriptfilter>
 </tokenfilter>
-
 
+Remove lines containing the string "bad" while +copying text files: +
+
+<copy todir="dist">
+  <fileset dir="src" includes="**/*.txt"/>
+  <scriptfilter language="beanshell">
+      if (self.getToken().indexOf("bad") != -1) {
+          self.setToken(null);
+      }
+  </scriptfilter>
+</copy>
+    
+
+

Custom tokenizers and string filters

Custom string filters and tokenizers may be plugged in by