Dynamator Pure HTML for every page generation technology.
           

dynamator.ant.DynamateTask

Description

Ant task to Dynamate an XML or HTML file, creating a server page or program.

Parameters

attribute description default value required?
destdir The root directory for output files. If this value begins with an asterisk, the remaining value is appended to the name of the directory in which the input file is found.   required
destsuffix The suffix Dynamator is expected to give to output files. This value is only used to locate the output file. The file suffix is determined by the <dynamator> tag within the Dynamator file.   required
dynfile The Dynamator file to be applied to argument template files. Overrides file name matching.   optional
dynsuffix The suffix Dynamator is expected to use for Dynamator files. dyn required
srcdir The root directory for Dynamator argument files. This directory is used to locate files identified with the includes attribute. Usually, this is the directory that contains template files (e.g. html or xml).   required
matchdir The root directory for files to be matched to Dynamator argument files. If argument files are template files, then this is the directory that contains Dynamator files. If argument files are Dynamator files, this is the directory that contains template files. srcdir optional
encoding Use the Java character encoding specified to read the input file. ASCII optional
excludes Comma-separated list of filepath patterns to be excluded during template file selection. If omitted, all files under srcdir are included.   optional
force 'true' to cause Dynamator to rebuild all files regardless of their timestamps. false optional
gencomment 'false' to omit the file generation comment from the output file. true optional
ignoreasxml 'true' to always convert HTML to XML, even if the asxml file is newer than the HTML file. false optional
html 'true' to treat all template files as HTML. If not specified, files having a suffix other than ".html" or ".htm" are treated as XML. false optional
xml 'true' to treat all template files as XML. If not specified, files having a suffix ".html" or ".htm" are treated as HTML. false optional
bodyonlyhtml 'true' to process template files as Body-Only HTML. This option generates server page files that output HTML fragments to be inserted into the body of the page. The template file is processed by JTidy, but the <html>, </html>, <body>, and </body>, tags and the <head> element are all removed. false optional
includeds Comma-separated list of filepath patterns of dynamator files included using Dynamator's include mechanism. These files are assumed to reside under 'matchdir' (which means that this option won't work when dynamator files are in 'srcDir'; I'll figure that out later). If specified, target files are rebuilt if they are older than any of these files.

Example: **/*.dyninclude

  optional
includes Comma-separated list of filepath patterns to be included during argument file selection. These are usually template file names. If omitted, all files under srcdir are included.

Example: **/*.html

  optional
includepath A colon- or semicolon-separated list of directories to be searched for included files.   optional
includepathref A reference to a path specifying the directories to be searched for included files.   optional
indent 'false' to not indent output. true optional
pretend 'true' to cause no action to be taken. Use with 'ant -v' to report what would have been done (like make -n). false optional
reportversion 'true' to report the Dynamator version. false optional
stripcomments 'true' to remove all HTML or XML comments from the generated file. false optional
templatedir Directory containing templates referred to in the dynamator tag's template attribute.   optional
trace 'true' to output an execution trace. Any other value is used as a filename for trace output. false optional
validate 'true' to validate Dynamator files; false to process without validation. true optional

Parameters specified as nested elements

includepath

The 'includepath' attribute is a path-like structure and may be set using a nested 'includepath' element.

Behavior

  1. The Dynamate task searches the templates directory tree for all files under srcdir matching the includes pattern.
  2. For each template file found, the task looks for a matching file in the corresponding directory under matchdir, with the suffix ".dyn". Template files that do not have matching .dyn files are excluded from further processing.
  3. For each match found, the task looks for a target file under destdir, with the suffix specified in destsuffix.
  4. If the target file is not found, Dynamator is executed for that file.
  5. If the target file is found, the timestamps of all three files (template, .dyn, and destination) are compared. If either the template file or the .dyn file have a newer timestamp than the destination file, Dynamator is executed for that file.

Example

<taskdef name="dynamate" classname="dynamator.ant.DynamateTask"/>
...
<target name="create-jsp">
  <dynamate
      srcdir="html"
      destdir="htdocs"
      matchdir="dyn"
      destsuffix="jsp"
      includes="**/*.html"
  />
</target>

Dynamates each file html/**/x.html that has a matching file dyn/**/x.dyn, placing the output in htdocs/**/x.jsp.