Andrew Black wrote:
> So  a.dat ->  a.html  b.dat ->  b.html  etc.  I want to process all .dat
> files in a particular directory.
> The rest of the site uses tpage.

If you just want to process all the .dat files as templates, you can use
ttree with the '--suffix dat=html' option. This will write the output
for each .dat template to the corresponding .html file in the output
directory.

If the .dat files are data files that you want to load in and present
using a template, then you can do it using a combination of the
Directory plugin (to read the data files in the source directory) and
the redirect filter (to write the output to a new file).

Something like this:

  [% USE Directory('/path/to/templates/data');

     FOREACH datafile IN Directory.files;
       # change file extension
       outfile = datafile.replace('\.dat', '.html');

       # redirect output to .html file
       FILTER redirect(outfile);
           # do something with data file to generate output
       END;
     END;
  %]

HTH
A


_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to