<?xml version="1.0"?>

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

	<description>
		description: "Gobo Eiffel String Library documentation"
		copyright: "Copyright (c) 2005, Eric Bezault and others"
		license: "Eiffel Forum License v2 (see forum.txt)"
		date: "$Date: 2005/07/07 13:58:21 $"
		revision: "$Revision: 1.1 $"
	</description>

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

	<target name="install" depend="init">
		<description>
			Install the Gobo Eiffel String Library 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="index"/>
		<set name="current" value="index"/>
		<geant target="xslt_and_shift" arguments="formatter/index"/>

		<set name="target" value="install"/>
		<geant target="do_all"/>
	</target>

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

		<set name="target" value="clean"/>
		<geant target="do_all"/>
	</target>

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

		<delete file="index.html"/>
		<set name="target" value="clobber"/>
		<geant target="do_all"/>
	</target>

<!-- Implementation -->

	<target name="init">
		<!-- do nothing -->
	</target>

	<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;'index.html'&quot;"/>
		</xslt>
	</target>

	<target name="do_all" depend="init">
		<description>
			Call 'geant' with the same target ${target}
			in all subdirectories.
		</description>

		<geant file="build.eant" target="${target}" dir="formatter"/>
	</target>

</project>
