blob: 1da04de45ddecc4ccd01511fb81e0700ad714507 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<project name="org.eclipse.linuxtools.oprofile.doc" default="all">
<description>
Generate Eclipse help content for the Linux Tools OProfile user guide
</description>
<property name="oprofile.help.doc.url.base" value="http://wiki.eclipse.org"/>
<property name="oprofile.wiki.url.base" value="${oprofile.help.doc.url.base}/Linux_Tools_Project/OProfile"/>
<property name="imageFolder" value="images"/>
<path id="tasks.classpath" path="bin"/>
<!-- See the paths below?
Check org.eclipse.mylyn.wikitext.{core,mediawiki.core} into your workspace
from Mylyn CVS (under tools project in eclipse.org CVS)
-->
<path id="wikitext.tasks.classpath">
<pathelement location="../org.eclipse.mylyn.wikitext.core/@dot"/>
<pathelement location="../org.eclipse.mylyn.wikitext.core/bin"/>
<pathelement location="../org.eclipse.mylyn.wikitext.mediawiki.core/@dot"/>
<pathelement location="../org.eclipse.mylyn.wikitext.mediawiki.core/bin"/>
</path>
<taskdef classpathref="tasks.classpath" resource="org/eclipse/linuxtools/internal/oprofile/doc/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>
<target name="all" depends="init" description="Generate Eclipse help content for the Linux Tools OProfile user guide">
<eclipse-wiki-to-help
help.doc.filenamenoextension="OProfile Reference"
help.doc.url.base="${oprofile.help.doc.url.base}"
help.doc.url.html="${oprofile.wiki.url.base}/User_Guide"
help.doc.url.xml="${oprofile.help.doc.url.base}/Special:Export/Linux_Tools_Project/OProfile/User_Guide"
help.imagefolder="${imageFolder}"
targetfolder="userguide"
wiki.url.base="${oprofile.help.doc.url.base}/Linux_Tools_Project"/>
</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>
<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>
-->
<mediawiki-fetch-images src="tmp/help.doc.html" dest="tmp" base="@{help.doc.url.base}"/>
<xslt style="extract-markup.xsl" in="tmp/help.doc.xml" out="tmp/@{help.doc.filenameNoExtension}.mediawiki"/>
<echo append="true" file="tmp/@{help.doc.filenameNoExtension}.mediawiki">
= Updating This Document =
This document is maintained in a collaborative wiki. If you wish to update or modify this document please visit
@{help.doc.url.html}
</echo>
<!-- Removing Phoenix extensions -->
<replaceregexp match="\{\{\#eclipseproject.*" replace="" flags="g" byline="true">
<fileset dir="tmp" includes="**/*.mediawiki"/>
</replaceregexp>
<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="${imageFolder}"
formatoutput="true">
<fileset dir="tmp" includes="**/*.mediawiki"/>
<stylesheet url="book.css"/>
</wikitext-to-eclipse-help>
<wikitext-to-docbook markupLanguage="org.eclipse.mylyn.wikitext.mediawiki.core.MediaWikiLanguage"
internallinkpattern="@{wiki.url.base}/{0}"
validate="true"
failonvalidationerror="true"
overwrite="true">
<fileset dir="tmp" includes="**/*.mediawiki"/>
</wikitext-to-docbook>
<mkdir dir="@{targetFolder}/${imageFolder}"/>
<copy todir="@{targetFolder}/${imageFolder}" overwrite="true">
<fileset dir="tmp">
<include name="*.gif"/>
<include name="*.png"/>
</fileset>
</copy>
<copy todir="@{targetFolder}" overwrite="true">
<fileset dir="tmp">
<include name="*.html"/>
<include name="*.xml"/>
<exclude name="help.doc.html"/>
<exclude name="help.doc.xml"/>
</fileset>
</copy>
<antcall target="test"/>
</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>