<?xml version="1.0" encoding="UTF-8"?> | |
<!-- | |
Licensed to the Apache Software Foundation (ASF) under one | |
or more contributor license agreements. See the NOTICE file | |
distributed with this work for additional information | |
regarding copyright ownership. The ASF licenses this file | |
to you under the Apache License, Version 2.0 (the | |
"License"); you may not use this file except in compliance | |
with the License. You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, | |
software distributed under the License is distributed on an | |
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
KIND, either express or implied. See the License for the | |
specific language governing permissions and limitations | |
under the License. | |
--> | |
<!-- Assumes the following preconditions and properties are set: | |
"prepare" task is done | |
properties set or not (flags) | |
skip-or-uptodate.pdf | |
skip-or-uptodate.html-single | |
skip-or-uptodate.html-chunked | |
properties identifying paths and names: | |
${docbook.src.dir} | |
${book_name} | |
${chapter_name} | |
${target.dir.path} | |
${docbook.outname} | |
${styles.dir} | |
${local.titlepage.dir} | |
${olink.dir.path} | |
${docbook.xsl.dir} | |
properties identifying versions: | |
${fop.version} | |
misc properties: | |
${paper.type} | |
${olink_work} | |
${fop.main.class} | |
references: | |
saxon_and_fop.classpath | |
--> | |
<project name="process-one-book" default="all"> | |
<import file="common-properties-per-book.xml"/> | |
<!-- ======================================================================== --> | |
<!-- == == --> | |
<!-- == This is the main target to generate all the docs == --> | |
<!-- == == --> | |
<!-- ======================================================================== --> | |
<target name="all" depends="pdf-c, html-c, htmlsingle-c" | |
description="--> Generate html and pdf documentation"/> | |
<target name="pdf-c" depends="setup-common-properties-per-book, copy-docbook-images-and-css" unless="skip-or-uptodate.pdf"> | |
<antcall target="pdf"> | |
<reference refid="saxon_and_fop.classpath"/> | |
</antcall> | |
</target> | |
<target name="html-c" depends="setup-common-properties-per-book, copy-docbook-images-and-css" unless="skip-or-uptodate.html-chunked"> | |
<antcall target="html"> | |
<reference refid="saxon_and_fop.classpath"/> | |
</antcall> | |
</target> | |
<target name="htmlsingle-c" depends="setup-common-properties-per-book, copy-docbook-images-and-css" unless="skip-or-uptodate.html-single"> | |
<antcall target="htmlsingle"> | |
<reference refid="saxon_and_fop.classpath"/> | |
</antcall> | |
</target> | |
<!-- ======================================================================== --> | |
<!-- == == --> | |
<!-- == Create the PDF documentation == --> | |
<!-- == == --> | |
<!-- ======================================================================== --> | |
<target name="pdf" | |
depends="transform-pdf, fop_conditionally" | |
description="--> Generate PDF docs"/> | |
<target name="transform-pdf" depends="transform-title-pdf, transform-source-pdf" | |
description="--> internal transform for pdf output"/> | |
<target name="transform-source-pdf" description="--> internal transform source for pdf output"> | |
<!--echo message="docbook.xsl.root = file:///${docbook.xsl.dir}"/--> | |
<!--echo message="olink work = ${olink_work}"/--> | |
<saxon input="${docbook.src.dir}/${book_name}/${chapter_name}.xml" | |
output="${target.dir.path}/${chapter_name}/${docbook.outname}.pdf_src.xml" | |
style="${styles.dir}/top/pdf.xsl" | |
params="fop.version=${fop.version} | |
paper.type=${paper.type} | |
collect.xref.targets=${olink_work} | |
targets.filename=${olink.dir.path}/${chapter_name}/pdf-target.db | |
target.database.document=file:///${olink.dir.path}/olink_db_pdf.xml | |
current.docid=${chapter_name} | |
docbook.xsl.root=file:///${docbook.xsl.dir} | |
"/> | |
</target> | |
<target name="transform-title-pdf" unless="title-pdf-uptodate" | |
description="--> internal transform title page for pdf"> | |
<saxon input="${local.titlepage.dir}/titlepage-pdf.xml" | |
output="${local.titlepage.dir}/titlepage-pdf.xsl" | |
style="${docbook.xsl.dir}/template/titlepage.xsl"/> | |
</target> | |
<target name="transform-title-html" unless="title-html-uptodate" | |
description="--> internal trnasform title page for html"> | |
<saxon input="${local.titlepage.dir}/titlepage-html.xml" | |
output="${local.titlepage.dir}/titlepage-html.xsl" | |
style="${docbook.xsl.dir}/template/titlepage.xsl"/> | |
</target> | |
<target name="fop_conditionally" description="internal - runs fop conditionally" | |
unless="do_olinkdb_only"> | |
<java classname="${fop.main.class}" fork="true" maxmemory="256m" | |
dir="${target.dir.path}/${chapter_name}" classpathref="saxon_and_fop.classpath"> | |
<arg value="-c"/> | |
<arg value="${fop.config}"/> | |
<arg value="${target.dir.path}/${chapter_name}/${docbook.outname}.pdf_src.xml"/> | |
<arg value="${target.dir.path}/${chapter_name}/${docbook.outname}.pdf"/> | |
</java> | |
</target> | |
<!-- ======================================================================== --> | |
<!-- == == --> | |
<!-- == Create the HTML documentation, many pages == --> | |
<!-- == == --> | |
<!-- ======================================================================== --> | |
<target name="html" | |
depends="transform-title-html, transform-html-chunked" | |
description="--> Generate HTML docs in multiple files"/> | |
<target name="transform-html-chunked"> | |
<saxon input="${docbook.src.dir}/${book_name}/${chapter_name}.xml" | |
output="${target.dir.path}/${chapter_name}/${docbook.outname}.html" | |
style="${styles.dir}/top/html-chunked.xsl" | |
params="collect.xref.targets=${olink_work} | |
targets.filename=${olink.dir.path}/${chapter_name}/htmlsingle-target.db | |
target.database.document=file:///${olink.dir.path}/olink_db_htmlsingle.xml | |
current.docid=${chapter_name}"/> | |
</target> | |
<!-- ======================================================================== --> | |
<!-- == == --> | |
<!-- == Create the HTML documentation, one big page == --> | |
<!-- == == --> | |
<!-- ======================================================================== --> | |
<target name="htmlsingle" | |
depends="transform-title-html, transform-html-single, clean-if-olink-only" | |
description="--> Generate HTML docs in a single, big file"/> | |
<target name="transform-html-single"> | |
<!--echo message="${target.dir.path}/${chapter_name}/${docbook.outname}.html"/> | |
<echo message="olink work = ${olink_work}"/--> | |
<saxon input="${docbook.src.dir}/${book_name}/${chapter_name}.xml" | |
output="${target.dir.path}/${chapter_name}/${docbook.outname}.html" | |
style="${styles.dir}/top/html-single.xsl" | |
params="collect.xref.targets=${olink_work} | |
targets.filename=${olink.dir.path}/${chapter_name}/htmlsingle-target.db | |
target.database.document=file:///${olink.dir.path}/olink_db_htmlsingle.xml | |
current.docid=${chapter_name}"/> | |
</target> | |
<!-- next target cleans up 0-length output that sometimes appears for olink only --> | |
<target name="clean-if-olink-only" if="do_olinkdb_only"> | |
<delete quiet="true" file="${target.dir.path}/${chapter_name}/${docbook.outname}.html"/> | |
</target> | |
<target name="copy-docbook-images-and-css" unless="${target-book-images-uptodate}"> | |
<property name="target-book-images-uptodate" value="ignored"/> | |
<copy todir="${target.dir.path}/images/${book_name}"> | |
<fileset dir="${docbook.src.dir}/${book_name}/images" excludes="*/*.ppt"/> | |
</copy> | |
<copy todir="${target.dir.path}/${chapter_name}/css"> | |
<fileset dir="${css.dir}"/> | |
</copy> | |
</target> | |
<!-- ======================================================================== --> | |
<!-- == == --> | |
<!-- == Saxon Converter macro that uses commons-resolver == --> | |
<!-- == and xerces parser (to handle XIncludes) == --> | |
<!-- == == --> | |
<!-- == input: The file to transform == --> | |
<!-- == output: The transformation result == --> | |
<!-- == style: The Style Sheet used for the transformation == --> | |
<!-- == == --> | |
<!-- ======================================================================== --> | |
<macrodef name="saxon"> | |
<attribute name="input"/> | |
<attribute name="output"/> | |
<attribute name="style"/> | |
<attribute name="params" default=""/> | |
<sequential> | |
<!--echo message="input"/> | |
<echo message="@{input}"/--> | |
<java classname="com.icl.saxon.StyleSheet" fork="true" dir="${docbook.tool.project}" | |
classpathref="saxon_and_fop.classpath"> | |
<!-- The jvm args install the xerces parser to allow use of XIncludes --> | |
<jvmarg | |
value="-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/> | |
<jvmarg | |
value="-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl"/> | |
<jvmarg | |
value="-Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration"/> | |
<arg line="-x org.apache.xml.resolver.tools.ResolvingXMLReader"/> | |
<arg line="-y org.apache.xml.resolver.tools.ResolvingXMLReader"/> | |
<arg line="-r org.apache.xml.resolver.tools.CatalogResolver"/> | |
<!--arg value="-T"/--> | |
<arg value="-o"/> | |
<arg value="@{output}"/> | |
<arg value="@{input}"/> | |
<arg value="@{style}"/> | |
<arg line="@{params}"/> | |
</java> | |
</sequential> | |
</macrodef> | |
</project> |