<?xml version="1.0" encoding="utf-8"?>
<!-- This is the build file to build the Daimonin documentation using Ant.
  - To use this file, get Ant from http://ant.apache.org/ and in this
  - directory run "ant -projecthelp"
  -->
<project
    name    = "Daimonin Documentation"
    default = "all"
    basedir = "../.."
>

    <target
        name        = "all"
        description = "Validates the documentation source files and then generates all available formats"
        depends     = "bbcode, bookgui, phpwiki, html4, xhtml11, ascii"
    />

    <target
        name        = "validate"
        description = "Validates the documentation source files"
    >
        <xmlvalidate
            failonerror = "yes"
            lenient     = "no"
        >
            <fileset dir="src/doc" includes="**/*.dai" />
        </xmlvalidate>
    </target>

    <target
        name        = "bbcode"
        description = "Generates documentation in bbCode format"
        depends     = "validate"
    >
        <mkdir dir="gen/bbcode" />
        <xslt
            basedir   = "src/doc"
            destdir   = "gen/bbcode"
            extension = ".bbc"
            style     = "src/xslt/dai2bbcode.xslt"
            includes  = "**/*.dai"
        />
    </target>

    <target
        name        = "bookgui"
        description = "Generates documentation in Daimonin BookGUI format"
        depends     = "validate"
    >
        <mkdir dir="gen/bookgui" />
        <xslt
            basedir   = "src/doc"
            destdir   = "gen/bookgui"
            extension = ".book"
            style     = "src/xslt/dai2bookgui.xslt"
            includes  = "**/*.dai"
        />
    </target>

    <target
        name        = "phpwiki"
        description = "Generates documentation in phpWiki format"
        depends     = "validate"
    >
        <mkdir dir="gen/phpwiki" />
        <xslt
            basedir   = "src/doc"
            destdir   = "gen/phpwiki"
            extension = ".wiki"
            style     = "src/xslt/dai2phpwiki.xslt"
            includes  = "**/*.dai"
        />
    </target>

    <target
        name        = "html4"
        description = "Generates documentation in HTML 4.01 Strict format"
        depends     = "validate"
    >
        <mkdir dir="gen/html4" />
        <xslt
            basedir   = "src/doc"
            destdir   = "gen/html4"
            extension = ".html"
            style     = "src/xslt/dai2html4.xslt"
            includes  = "**/*.dai"
        />
        <copy
            todir = "gen/html4"
        >
            <fileset
                dir="src/doc"
            >
                <include name="**/*.gif" />
                <include name="**/*.png" />
                <include name="**/*.jfif" />
                <include name="**/*.jpeg" />
                <include name="**/*.jpg" />
                <include name="**/*.txt" />
                <include name="**/*.css" />
            </fileset>
        </copy>
    </target>

    <target
        name        = "xhtml11"
        description = "Generates documentation in XHTML 1.1 Strict format"
        depends     = "validate"
    >
        <mkdir dir="gen/xhtml11" />
        <xslt
            basedir   = "src/doc"
            destdir   = "gen/xhtml11"
            extension = ".xhtml"
            style     = "src/xslt/dai2xhtml11.xslt"
            includes  = "**/*.dai"
        />
        <copy
            todir = "gen/xhtml11"
        >
            <fileset
                dir="src/doc"
            >
                <include name="**/*.gif" />
                <include name="**/*.png" />
                <include name="**/*.jfif" />
                <include name="**/*.jpeg" />
                <include name="**/*.jpg" />
                <include name="**/*.txt" />
                <include name="**/*.css" />
            </fileset>
        </copy>
    </target>

    <target
        name        = "ascii"
        description = "Generates documentation in ASCII format"
        depends     = "validate"
    >
        <mkdir dir="gen/ascii" />
        <xslt
            basedir   = "src/doc"
            destdir   = "gen/ascii"
            extension = ".txt"
            style     = "src/xslt/dai2ascii.xslt"
            includes  = "**/*.dai"
        />
    </target>

</project>
