peterreilly 2003/11/12 01:35:31
Modified: docs/manual/CoreTypes filterchain.html
Log:
scriptfilter: clarify getToken and setToken methods, provide another example
Revision Changes Path
1.14 +18 -2 ant/docs/manual/CoreTypes/filterchain.html
Index: filterchain.html
===================================================================
RCS file: /home/cvs/ant/docs/manual/CoreTypes/filterchain.html,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- filterchain.html 19 Sep 2003 09:24:13 -0000 1.13
+++ filterchain.html 12 Nov 2003 09:35:31 -0000 1.14
@@ -1260,6 +1260,8 @@
<p>
The script is provided with an object <i>self</i> that has
getToken() and setToken(String) methods.
+The getToken() method returns the current token. The setToken(String)
+method replaces the current token.
</p>
This filter may be used directly within a filterchain.<p>
@@ -1286,15 +1288,29 @@
<H4>Examples:</H4>
-Convert to uppercase.
+Convert to uppercase:
<BLOCKQUOTE><PRE>
<tokenfilter>
<scriptfilter language="javascript">
self.setToken(self.getToken().toUpperCase());
</scriptfilter>
</tokenfilter>
-
</PRE></BLOCKQUOTE>
+
+Remove lines containing the string "bad" while
+copying text files:
+ <blockquote>
+ <pre>
+<copy todir="dist">
+ <fileset dir="src" includes="**/*.txt"/>
+ <scriptfilter language="beanshell">
+ if (self.getToken().indexOf("bad") != -1) {
+ self.setToken(null);
+ }
+ </scriptfilter>
+</copy>
+ </pre>
+ </blockquote>
<H4>Custom tokenizers and string filters</H4>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]