ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francis Galiegue <>
Subject Re: Need help with REPLACING an SSI directive
Date Thu, 30 Apr 2009 20:02:27 GMT
Le Thursday 30 April 2009 20:54:24 xak, vous avez écrit :
> First off, I am very new to using ANT and I'n not a Java developer but my
> needs are very simple ...
> I am creating a web site that is decently large but it must be static. So
> I'm thinking that I can develop the site locally using server-side includes
> to avoid hardcoding all the navigation, etc. and then "publish" the site
> using ANT where all the SSIs are replaced with the actual file contents.
> Replacing a token is easy enough but I don't know how to "regex" the
> comment syntax of the SSIs. Is that even the right approach? Can I use
> replace or do I need something else?
> This is in the SSI syntax in the HTML:
>   <!--#include file="_includes/_html_head_open.html" -->
> I need to replace with ${} as defined below:
>    <loadfile property=""
> srcFile="${src}/_includes/_html_head_open.html" />
> So I need something like this where the token is the SSI:
>    <replace dir="${output}" token=""
> value="${}" />
> The most important thing here is to be able to develop the source files,
> view them in the browser and then only at the end do a publish build where
> the SSIs are replaced. That's it.
> I know there are ANT tasks out there to turn various template markup into
> HTML but that is overkill for my needs.
> Any assistance will be greatly appreciated.
> Zack

Does the base file has a template? Say, you have a template HTML file, which 
reads, somewhere:

<!--#include file="${src}/_includes/_html_head_open.html"/>

Then you can do:

<copy overwrite="true" file="/place/where/the/template/is"
		<filter token="src" begintoken="$${" endtoken="}"

Even better, if the value for src is defined as a property in a file 
somewhere, you can do:

<copy overwrite="true" file="/place/where/the/template/is"
	<filterset begintoken="$${" endtoken="}"

Francis Galiegue
Ingénieur système
Mob : +33 (0) 683 877 875
Tel : +33 (0) 178 945 552
40 avenue Raymond Poincaré
75116 Paris

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message