Preprocessing with freemarker
Description
Ant4docbook preprocess docbook files as freemarker templates, to add variables and conditions if needed.
Preprocessing parameters
Attribute | Description | Value | Required |
---|---|---|---|
file | docbook file | yes | |
tofile | output file | <file name>.pdf | yes |
preprocessor | true|false | yes | |
Element | Description | Value | Required |
parameter | freemarker parameters |
/!\ DO NOT USE DOT [.]
IN VARIABLE NAMES |
no |
Examples
<?xml version="1.0" encoding="utf-8"?> <article xml:lang="en"> <title>$ {custom_title}</title> <section id="section1"> <title>Section level 1</title> <para> write your documentation with some conditions [# if (output_format_is_pdf)??] <xref linkend="appendix-xxx" /> [# else] <ulink url="appendix-xxx.html">appendix-xxx</ulink> [/ #if] </para> </section> </article>
<project name="ant-project" default="docbbook-preprocessing"> <target name="docbbook-preprocessing"> <!-- define <dbk> ant task here, with preprocessor parameter set to true --> <dbk file="docbook.xml" tofile="file.html" preprocessor="true"> <parameter name="custom_title" value="My Custom Title" /> </dbk> <dbk file="docbook.xml" tofile="file.pdf" preprocessor="true"> <parameter name="custom_title" value="My Custom Title" /> <parameter name="output_format_is_pdf" value="true" /> </dbk> </target> </project>