1 <?xml version="1.0" encoding="UTF-8"?><!--
2 Copyright (c) 2010 Chris Aniszczyk and others.
3 All rights reserved. This program and the accompanying materials
4 are made available under the terms of the Eclipse Public License v1.0
5 which accompanies this distribution, and is available at
6 http://www.eclipse.org/legal/epl-v10.html
9 Chris Aniszczyk - initial API and implementation
12 <project name="org.eclipse.egit.doc" default="all">
14 Generate Eclipse help content for the EGit user guide
17 <property name="help.doc.url.base" value="http://wiki.eclipse.org"/>
18 <property name="wiki.url.base" value="${help.doc.url.base}/EGit"/>
19 <property name="imageFolder" value="images"/>
20 <property name="tmpFolder" value="target/tmp"/>
22 <path id="wikitext.tasks.classpath">
24 <include name="org.eclipse.mylyn.wikitext.*core*.jar"/>
28 <taskdef classpathref="wikitext.tasks.classpath" resource="org/eclipse/mylyn/internal/wikitext/mediawiki/core/tasks/tasks.properties"/>
29 <taskdef classpathref="wikitext.tasks.classpath" resource="org/eclipse/mylyn/wikitext/core/util/anttask/tasks.properties"/>
32 <mkdir dir="${tmpFolder}"/>
35 <target name="clean" depends="init">
36 <delete includeemptydirs="true" failonerror="false">
37 <fileset dir="${tmpFolder}"/>
41 <target name="all" depends="init" description="Generate Eclipse help content for the EGit user guide">
43 help.doc.filenamenoextension="EGit User Guide"
44 help.doc.url.base="${help.doc.url.base}"
45 help.doc.pageName="EGit/User_Guide"
46 help.imagefolder="${imageFolder}"
47 targetfolder="userguide"
48 wiki.url.base="${help.doc.url.base}/EGit"/>
49 <replaceregexp file="userguide/EGit User Guide-toc.xml" match="(<topic.*?href="userguide/Task-Repository-Connectors.html.*?>(\s*<topic\s*href=".*?"\s*label=".*">\s*?</topic>)+)(\s*)(</topic>)"
50 replace="\1\3<anchor id="additions-repository-connectors"/>\3\4"
54 <macrodef name="eclipse-wiki-to-help">
55 <attribute name="help.doc.url.base"/>
56 <attribute name="wiki.url.base"/>
57 <attribute name="help.doc.pageName"/>
58 <attribute name="help.doc.filenameNoExtension"/>
59 <attribute name="help.imageFolder"/>
60 <attribute name="targetFolder"/>
62 <get dest="${tmpFolder}/@{help.doc.filenameNoExtension}.mediawiki" src="@{help.doc.url.base}/index.php?title=@{help.doc.pageName}&action=raw"/>
63 <echo append="true" file="${tmpFolder}/@{help.doc.filenameNoExtension}.mediawiki">
65 = Updating This Document =
67 This document is maintained in a collaborative wiki. If you wish to update or modify this document please visit
68 @{help.doc.url.base}/@{help.doc.pageName}
71 <copy todir="${tmpFolder}">
72 <fileset dir="userguide/images"/>
74 <mediawiki-fetch-images dest="${tmpFolder}" url="@{help.doc.url.base}" pageName="@{help.doc.pageName}"/>
76 <wikitext-to-eclipse-help markupLanguage="org.eclipse.mylyn.wikitext.mediawiki.core.MediaWikiLanguage"
77 multipleOutputFiles="true"
78 navigationImages="true"
79 helpPrefix="@{targetFolder}"
80 internallinkpattern="@{wiki.url.base}/{0}"
82 failonvalidationerror="true"
83 prependImagePrefix="${imageFolder}"
85 defaultAbsoluteLinkTarget="mylyn_external">
86 <fileset dir="${tmpFolder}" includes="**/*.mediawiki"/>
87 <stylesheet url="book.css"/>
88 </wikitext-to-eclipse-help>
90 <mkdir dir="@{targetFolder}/${imageFolder}"/>
91 <copy todir="@{targetFolder}/${imageFolder}" overwrite="true">
92 <fileset dir="${tmpFolder}">
93 <include name="*.gif"/>
94 <include name="*.png"/>
97 <copy todir="@{targetFolder}" overwrite="true">
98 <fileset dir="${tmpFolder}">
99 <include name="*.html"/>
100 <include name="*toc.xml"/>
101 <exclude name="help.doc.html"/>
104 <antcall target="test"/>
108 <target name="test" depends="init" description="verify that all of the HTML files are well-formed XML">
110 Validating help content XML and HTML files: The Eclipse help system expects well-formed XML
112 If validation fails it is because either:
114 * the userguide source code is poorly formed, or
115 * the WikiText MediaWiki parser has a bug
117 Problems with userguide source are usually caused by improper use of HTML markup in the MediaWiki source,
118 or inadvertently starting a line with a space character (in MediaWiki this starts a preformatted block)
122 Don't bother with DTD validation: we only care if the files are well-formed.
123 We therefore provide an empty DTD
125 <echo file="${tmpFolder}/__empty.dtd" message=""/>
126 <xmlvalidate lenient="true">
127 <fileset dir="userguide">
128 <include name="**/*.xml"/>
130 <fileset dir="userguide">
131 <include name="**/*.html"/>
133 <dtd publicid="-//W3C//DTD XHTML 1.0 Transitional//EN" location="${basedir}/${tmpFolder}/__empty.dtd"/>