<?xml version="1.0" encoding="UTF-8"?> | |
<project name="help.common" basedir="."> | |
<property name="extract.style.sheet" value="${ant.file.imported}/extract-markup.xsl" /> | |
<property name="eclipse.plugin.dir" value="${eclipse.home}/plugins" /> | |
<property name="wikitext.build" value="1.0.1.v20090411-0400-e3x" /> | |
<path id="tasks.classpath"> | |
<pathelement location="../org.eclipse.osee.framework.help.ui/bin" /> | |
</path> | |
<path id="wikitext.tasks.classpath"> | |
<pathelement location="${eclipse.plugin.dir}/org.eclipse.mylyn.wikitext.core_${wikitext.build}.jar" /> | |
<pathelement location="${eclipse.plugin.dir}/org.eclipse.mylyn.wikitext.mediawiki.core_${wikitext.build}.jar" /> | |
</path> | |
<taskdef classpathref="tasks.classpath" resource="org/eclipse/osee/framework/help/ui/internal/anttask/tasks.properties" /> | |
<taskdef classpathref="wikitext.tasks.classpath" resource="org/eclipse/mylyn/wikitext/core/util/anttask/tasks.properties" /> | |
<target name="init"> | |
<mkdir dir="tmp" /> | |
</target> | |
<target name="clean" depends="init"> | |
<delete includeemptydirs="true" failonerror="false"> | |
<fileset dir="tmp" /> | |
</delete> | |
</target> | |
<macrodef name="eclipse-wiki-to-help"> | |
<attribute name="help.doc.url.base" /> | |
<attribute name="wiki.url.base" /> | |
<attribute name="help.doc.url.html" /> | |
<attribute name="help.doc.url.xml" /> | |
<attribute name="help.doc.filenameNoExtension" /> | |
<attribute name="help.imageFolder" /> | |
<attribute name="targetFolder" /> | |
<sequential> | |
<antcall target="init" /> | |
<get dest="tmp/help.doc.xml" src="@{help.doc.url.xml}" /> | |
<get dest="tmp/help.doc.html" src="@{help.doc.url.html}" /> | |
<copy todir="tmp"> | |
<fileset dir="images" /> | |
</copy> | |
<osee-mediawiki-fetch-images src="tmp/help.doc.html" | |
dest="tmp/" base="@{help.doc.url.base}" /> | |
<xslt style="${extract.style.sheet}" in="tmp/help.doc.xml" out="tmp/@{help.doc.filenameNoExtension}.mediawiki" /> | |
<wikitext-to-eclipse-help markupLanguage="org.eclipse.mylyn.wikitext.mediawiki.core.MediaWikiLanguage" multipleOutputFiles="true" navigationImages="true" helpPrefix="@{targetFolder}" internallinkpattern="@{wiki.url.base}/{0}" validate="true" failonvalidationerror="true" prependImagePrefix="@{help.imageFolder}" formatoutput="true"> | |
<!--defaultAbsoluteLinkTarget="osee_external"--> | |
<fileset dir="tmp" includes="**/*.mediawiki" /> | |
<stylesheet url="book.css" /> | |
</wikitext-to-eclipse-help> | |
<mkdir dir="@{targetFolder}/@{help.imageFolder}" /> | |
<copy todir="@{targetFolder}/@{help.imageFolder}" overwrite="true"> | |
<fileset dir="tmp"> | |
<exclude name="*.html" /> | |
<exclude name="*.mediawiki" /> | |
<exclude name="*.xml" /> | |
<exclude name="*.dtd" /> | |
</fileset> | |
</copy> | |
<copy todir="@{targetFolder}" overwrite="true"> | |
<fileset dir="tmp"> | |
<include name="*.html" /> | |
<include name="*toc.xml" /> | |
<exclude name="help.doc.html" /> | |
</fileset> | |
</copy> | |
<mkdir dir="@{targetFolder}/@{help.imageFolder}/@{help.imageFolder}" /> | |
<copy todir="@{targetFolder}/@{help.imageFolder}/@{help.imageFolder}" overwrite="true"> | |
<fileset dir="${ant.file.imported}/commonImages" /> | |
</copy> | |
<antcall target="test" /> | |
<antcall target="clean" /> | |
</sequential> | |
</macrodef> | |
<target name="test" depends="init" description="verify that all of the HTML files are well-formed XML"> | |
<echo level="info"> | |
Validating help content XML and HTML files: The Eclipse help system expects well-formed XML. | |
If validation fails it is because either: | |
* the userguide source code is poorly formed, or | |
* the WikiText MediaWiki parser has a bug | |
Problems with userguide source are usually caused by improper use of HTML markup in the MediaWiki source, | |
or inadvertently starting a line with a space character (in MediaWiki this starts a preformatted block). | |
</echo> | |
<!--Don't bother with DTD validation: we only care if the files are well-formed. We therefore provide an empty DTD--> | |
<echo file="tmp/__empty.dtd" message="" /> | |
<xmlvalidate lenient="true"> | |
<fileset dir="userguide"> | |
<include name="**/*.xml" /> | |
</fileset> | |
<fileset dir="userguide"> | |
<include name="**/*.html" /> | |
</fileset> | |
<dtd publicid="-//W3C//DTD XHTML 1.0 Transitional//EN" location="${basedir}/tmp/__empty.dtd" /> | |
</xmlvalidate> | |
</target> | |
</project> |