<?xml version="1.0"?>

<project name="geant_doc" default="help">

	<description>
		description: "Gobo Eiffel Ant Documentation"
		copyright: "Copyright (c) 2002-2003, Sven Ehrke and others"
		license: "Eiffel Forum License v2 (see forum.txt)"
		date: "$Date: 2005/07/07 13:35:29 $"
		revision: "$Revision: 1.18 $"
	</description>

	<target name="help">
		<echo message="usage:"/>
		<echo message="   geant install"/>
		<echo message="   geant clean"/>
		<echo message="   geant clobber"/>
	</target>

	<target name="install">
		<description>
			Install the Gobo Eiffel Ant Documentation.
		</description>

		<set name="xslt_processor" value="gexslt" unless="$GOBO_XSLT_PROCESSOR"/>
		<set name="xslt_processor" value="${GOBO_XSLT_PROCESSOR}" if="${GOBO_XSLT_PROCESSOR}"/>

		<set name="previous" value="overview"/>
		<set name="current" value="overview"/>
		<geant target="xslt_and_shift" arguments="introduction"/>
		<geant target="xslt_and_shift" arguments="examples"/>
		<geant target="xslt_and_shift" arguments="builtin_variables"/>
		<geant target="xslt_and_shift" arguments="target"/>
		<geant target="xslt_and_shift" arguments="tasks"/>
		<geant target="xslt_and_shift" arguments="fileset_element"/>
		<geant target="xslt_and_shift" arguments="map_element"/>
		<geant target="xslt_and_shift" arguments="available_task"/>
		<geant target="xslt_and_shift" arguments="copy_task"/>
		<geant target="xslt_and_shift" arguments="delete_task"/>
		<geant target="xslt_and_shift" arguments="echo_task"/>
		<geant target="xslt_and_shift" arguments="exec_task"/>
		<geant target="xslt_and_shift" arguments="exit_task"/>
		<geant target="xslt_and_shift" arguments="geant_task"/>
		<geant target="xslt_and_shift" arguments="gelex_task"/>
		<geant target="xslt_and_shift" arguments="geyacc_task"/>
		<geant target="xslt_and_shift" arguments="gepp_task"/>
		<geant target="xslt_and_shift" arguments="getest_task"/>
		<geant target="xslt_and_shift" arguments="gexace_task"/>
		<geant target="xslt_and_shift" arguments="gexmlsplit_task"/>
		<geant target="xslt_and_shift" arguments="ise_task"/>
		<geant target="xslt_and_shift" arguments="mkdir_task"/>
		<geant target="xslt_and_shift" arguments="move_task"/>
		<geant target="xslt_and_shift" arguments="outofdate_task"/>
		<geant target="xslt_and_shift" arguments="precursor_task"/>
		<geant target="xslt_and_shift" arguments="se_task"/>
		<geant target="xslt_and_shift" arguments="set_task"/>
		<geant target="xslt_and_shift" arguments="setenv_task"/>
		<geant target="xslt_and_shift" arguments="unset_task"/>
		<geant target="xslt_and_shift" arguments="ve_task"/>
		<geant target="xslt_and_shift" arguments="xslt_task"/>
		<geant target="xslt_and_shift" arguments="overview"/>
	</target>

	<target name="clean">
		<description>
			Remove intermediary generated files.
		</description>

		<!-- do nothing -->
	</target>

	<target name="clobber">
		<description>
			Remove all generated files.
		</description>

		<delete file="overview.html"/>
		<delete file="introduction.html"/>
		<delete file="examples.html"/>
		<delete file="builtin_variables.html"/>
		<delete file="target.html"/>
		<delete file="tasks.html"/>
		<delete file="fileset_element.html"/>
		<delete file="map_element.html"/>
		<delete file="available_task.html"/>
		<delete file="copy_task.html"/>
		<delete file="delete_task.html"/>
		<delete file="echo_task.html"/>
		<delete file="exec_task.html"/>
		<delete file="exit_task.html"/>
		<delete file="geant_task.html"/>
		<delete file="gelex_task.html"/>
		<delete file="geyacc_task.html"/>
		<delete file="gepp_task.html"/>
		<delete file="getest_task.html"/>
		<delete file="gexace_task.html"/>
		<delete file="gexmlsplit_task.html"/>
		<delete file="ise_task.html"/>
		<delete file="mkdir_task.html"/>
		<delete file="move_task.html"/>
		<delete file="outofdate_task.html"/>
		<delete file="precursor_task.html"/>
		<delete file="se_task.html"/>
		<delete file="set_task.html"/>
		<delete file="setenv_task.html"/>
		<delete file="unset_task.html"/>
		<delete file="ve_task.html"/>
		<delete file="xslt_task.html"/>
	</target>

<!-- Implementation -->

	<target name="xslt_and_shift" export="NONE">
		<description>
			Call `xslt' and shift variables `previous' and `current' one chapter forward.
		</description>
		<argument name="a_next"/>

		<geant target="xslt" arguments="${previous},${current},${a_next}"/>
			<!-- Shift parameters -->
		<set name="previous" value="${current}"/>
		<set name="current" value="${a_next}"/>
	</target>

	<target name="xslt" export="NONE">
		<description>
			Execute XSL Transformation for argument ${a_file}, ${a_previous}
			and ${a_next} using processor ${xslt_processor}.
		</description>
		<argument name="a_previous"/>
		<argument name="a_file"/>
		<argument name="a_next"/>

		<xslt processor="${xslt_processor}" input="${a_file}.xml" output="${a_file}.html" stylesheet="${GOBO}/doc/misc/gobo2html2.xsl">
			<parameter name="previous" value="&quot;'${a_previous}.html'&quot;"/>
			<parameter name="next" value="&quot;'${a_next}.html'&quot;"/>
			<parameter name="toc" value="&quot;'overview.html'&quot;"/>
		</xslt>
	</target>

</project>
