Rob Harvey wrote:

Hi,
I wrote a Task recently that alters files as they are copied to
different directories. I used it to create a website and it serves we
quite well - I imagine it would be useful for other applications where
more complex copying operations are required.
It basically works like this:
       <taskdef name="tcopy" classname="TemplateCopy" classpath="."/>
       <tcopy templatefile="${tfile}" outdir="${outdir}" srcdir="${srcdir}">
         <include name="**/*.tmpl"/>
       </tcopy>
       <tcopy templatefile="${jsfile}" outdir="${outdir}"
srcdir="${srcdir}" ext=".js">
         <include name="rolling.tmjs"/>
       </tcopy>

What it is saying is, for every file in the include list, make a token
replacement copy of the file "templatefile" to "outdir" with the
appropriate extension. So if srcdir contained 10 *.tmpl files, then 10
files (with the default *.html extension) will end up in the outdir
location, where the values in the *.tmpl files are inserted into the
base "templatefile".

In other words, I have one templatefile that contains generic
information plus some tokens:
<html>
 <head>
  <title>@TITLE@</title>
 </head>
 <body>
  <h1>Some general info</h1>
  @CONTENT@
 </body>
</html>

and then some others - let's say "welcome.tmpl" - that contain only
token, value pairs:

@TITLE@
 Welcome page
@CONTENT@
   <p>Welcome to my page</p>

Then the resulting page would be "welcome.html" in the outdir directory.

Is there any interest in including this with optional tasks?

-rob
What would be the added value over the current copy task with the use of a filterset?

Martijn

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to