<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
<!-- for some information on what you could do (e.g. targets to override). -->
<!-- If you delete this file and reopen the project it will be recreated. -->
<project name="com.jme3.gde.docs" default="netbeans" basedir=".">
    <description>Builds, tests, and runs the project com.jme3.gde.docs.</description>
    <import file="nbproject/build-impl.xml"/>
    
    <path id="ant-import.classpath">
        <fileset dir="../ant-lib/" includes="*.jar"/>
    </path>
    <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="ant-import.classpath"/>
    <taskdef resource="com/jme/ant/ant-jme.properties" classpath="../ant-lib/ant-jme.jar"/>

    <!--target name="init" depends="basic-init,files-init,build-init,-javac-init,update-help-sets">
    </target-->

    <target name="update-help-sets" description="Updates the help pages from the wiki">
        <property file="src/com/jme3/gde/docs/wiki-download-index.properties"/>
        <echo file="src/${javahelp_path}/wiki-map.xml"
              message='&lt;!DOCTYPE map PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp Map Version 2.0//EN" "http://java.sun.com/products/javahelp/map_2_0.dtd">&#13;&lt;map version="2.0">&#13;'/>
        <echo file="src/${javahelp_path}/wiki-map.xml" append="true"
              message='&lt;!-- DO NOT EDIT THIS FILE, EDIT wiki-download-index.properties INSTEAD! -->&#13;'/>
        <foreach target="-update-single-helpset" list="${wiki_pages}" delimiter="," param="page_name" inheritall="true"/>
        <echo file="src/${javahelp_path}/wiki-map.xml" append="true"
              message='&lt;/map>&#13;'/>
    </target>

    <target name="-update-single-helpset">
        <!-- prepare variables -->
        <propertyregex property="page_path"
                       input="${page_name}"
                       regexp=":"
                       replace="/"
                       global="true"/>
        <propertyregex property="page_classpath"
                       input="${page_name}"
                       regexp=":"
                       replace="."
                       global="true"/>
        <!-- download html file -->
        <touch file="src/${javahelp_path}/${page_path}.html" mkdirs="true"/>
        <get src="${wiki_url}${page_name}?do=export_xhtmlbody"
             dest="src/${javahelp_path}/${page_path}.html"/>
        <!-- download images from page (custom task) -->
        <loadwikiimages file="src/${javahelp_path}/${page_path}.html"
                        target="src/${javahelp_path}/"
                        host="http://wiki.jmonkeyengine.org"/>
        <!-- fix links in wiki (custom task) -->
        <fixwikilinks file="src/${javahelp_path}/${page_path}.html"
                      helppath="${javahelp_path}/"/>
        <!-- append link to online wiki page -->
        <echo file="src/${javahelp_path}/${page_path}.html" append="true"
              message='&lt;p>&lt;em>&lt;a href="${wiki_url}${page_name}?do=export_xhtmlbody">view online version&lt;/a>&lt;/em>&lt;/p>'/>
        <!-- add entry to map -->
        <echo file="src/${javahelp_path}/wiki-map.xml" append="true"
              message='&lt;mapID target="${page_classpath}" url="${page_path}.html"/>&#13;'/>
    </target>
</project>