How about this (untested):
<copy todir='... if needed ...'>
<fileset dir='/web' includes='*.html' excludes='... if
needed...' />
<filterchain>
<concatfilter prepend=' header.html'
append='footer.html' />
</filterchain>
<mapper type='glob' from='*.part to='*.html' />
</copy>
If this isn't correct, it should be very close to gthe answer.
--
Jonathan Rosenberg
Founder & Executive Director, Tabby's Place
http://www.tabbysplace.org/
-----Original Message-----
From: Matthew Jaggard [mailto:[email protected]]
Sent: Monday, July 19, 2010 11:40 AM
To: Ant Users List
Subject: Re: [Newbie] Nice way of concatenating files
I saw this but couldn't work out how to apply it to a selection of
files as my script does. It needs to look for all scripts labeled
*.html.part and concatenate header.html, the file and then footer.html
to create *.html. For example for the following directory...
/web:
index.html.part
page1.html.part
I need to create
index.html from header.html + index.html.part + footer.html
and
page1.html from header.html + page1.html.part + footer.html
Thanks,
Mat.
On 19 July 2010 16:06, Jonathan Rosenberg <[email protected]> wrote:
> Ant's <concat/> task is what you want:
>
> http://ant.apache.org/manual/index.html
>
> --
> Jonathan Rosenberg
> Founder & Executive Director, Tabby's Place
> http://www.tabbysplace.org/
>
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of
> Matthew Jaggard
> Sent: Monday, July 19, 2010 11:00 AM
> To: user
> Subject: [Newbie] Nice way of concatenating files
>
> Hi,
> Sorry for the newbie question. I have written a task to concatenate
> files but want to do it better (in a more platform independent way) as
> it currently relies on "cat" being an available executable. Can anyone
> tell me how to do this using the <concat> task or anything?
>
> <target name="-pre-compile">
> <apply executable="cat">
> <arg value="${web.docbase.dir}/header.html "/>
> <srcfile/>
> <arg value="${web.docbase.dir}/footer.html "/>
> <fileset dir="${web.docbase.dir}/"
> includes="*.html.part" excludes="" />
> <mapper type="glob" from="*.html.part"
to="*.html"/>
> <redirector>
> <outputmapper id="out" type="glob"
> from="*.html.part"
> to="${build.web.dir}/*.html"/>
> </redirector>
> </apply>
> </target>
>
>
> Many thanks,
> Mat.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]