ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <>
Subject Re: How can I set last modified date in html files using ant?
Date Mon, 07 Feb 2005 01:07:33 GMT
At 09:59 PM 2/6/2005 +0000, you wrote:
 >Thank you for your reply.  I tried the suggestion.
 >Jacob Kjome wrote:
 >> This doesn't really seem like an Ant question at all.
 >I thought, at face value at least, it seemed like the kind of thing Ant
 >could do. For example, it is straight forward to insert todays date in a
 >bunch of html files...
 ><copy toDir="${dist.dir}/docs">
 >  <fileset dir="${build.dir}/docs">
 >    <include name="**/*.html">
 >  </fileset>
 >  <filterset>
 >    <filter token="DATE" value="${TODAY}"/>
 >  </filterset>

Well, if you make a place in each of your HTML files such as @TODAY@, then 
that'll work.  Otherwise you could use the DOM to insert text at a given place.

 >I thought there might be a similar to way to insert a last modified
 >date.  If there is a relatively straight forward to do it using Ant, I
 >would prefer it to using javascript.  For example, when I tried script
 >below, it worked fine with Firefox but with IE a dialogue box pops up
 >asking  "Are you sure you want to let this file run active content?" and
 >I have to click yes before I see the result.  I would obviously like to
 >avoid this if I can.

I've never seen that IE complain about the script.  Maybe you have your 
security setting cranked up higher than normal?  I wouldn't expect to see 
this on your average persons computer.   Firefox is generally considered 
more secure than IE.  If it isn't complaining, then you have something 
special in your IE settings.


 >> I think you can achieve what you want by displaying the last modified
 >> date via javascript.  Let the browser figure out the date.
 >> var lastmod = document.lastModified;    // get string of last modified
 >> date
 >> var lastmoddate = Date.parse(lastmod);  // convert modified string to
 >> date
 >> if(lastmoddate == 0) {                  // unknown date (or January 1,
 >> 1970 GMT)
 >>    document.writeln("Last Modified: Unknown");
 >> } else {
 >>   var d = new Date(lastmod);
 >>   document.writeln("Last Modified: " + d.toLocaleString());
 >> }
 >> I would put that in a separate lastmod.js file and include it wherever
 >> in the page you want the date displayed....
 >> <script src="lastmod.js" type="text/javascript"></script>
 >> Jake
 >> At 06:36 PM 2/5/2005 +0000, you wrote:
 >> >I want set the last modified date in html files from an ant script, so
 >> >that each file has a line reading, for example:
 >> >
 >> >"Last modified 04 February 2005" where the date is the date the file was
 >> >modified, not the date the ant script was run.
 >> >
 >> >I know I can achieve this using SSI with the following code:
 >> ><!--#config timefmt="%d  %B  %Y" -->
 >> >Last modified <!--#echo var="LAST_MODIFIED" -->
 >> >
 >> >However, this does not solve my problem since I want to distribute a
 >> >zipped documentation bundle containing the html files as well as
 >> >providing access to them over the web.
 >> >
 >> >I've search google and the mailing list archives but haven't been able
 >> >to find an answer.
 >> >
 >> >Any suggestions or pointers would be greatly appreciated.
 >> >
 >> >Luke Lindsay
 >> >
 >> >---------------------------------------------------------------------
 >> >To unsubscribe, e-mail:
 >> >For additional commands, e-mail:
 >> >
 >> >
 >> ---------------------------------------------------------------------
 >> To unsubscribe, e-mail:
 >> For additional commands, e-mail:
 >To unsubscribe, e-mail:
 >For additional commands, e-mail:

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

View raw message