Retrieve wikitext jars via OSGi dependencies and maven
[egit/spearce.git] / org.eclipse.egit.doc / build-help.xml
blob4ea8be165fb30d91d9d6dffa32722c81fa6a7f87
1 <?xml version="1.0" encoding="UTF-8"?><!--
2     Copyright (c) 2010 Chris Aniszczyk and others.
3     Copyright (c) 2010 Matthias Sohn <matthias.sohn@sap.com>
4     All rights reserved. This program and the accompanying materials
5     are made available under the terms of the Eclipse Public License v1.0
6     which accompanies this distribution, and is available at
7     http://www.eclipse.org/legal/epl-v10.html
9     Contributors:
10          Chris Aniszczyk - initial API and implementation
11          Matthias Sohn - maven integration
12  -->
14 <project name="org.eclipse.egit.doc" default="all">
15     <description>
16             Generate Eclipse help content for the EGit user guide
17     </description>
19         <property name="help.doc.url.base" value="http://wiki.eclipse.org"/>
20         <property name="wiki.url.base" value="${help.doc.url.base}/EGit"/>
21         <property name="imageFolder" value="images"/>
22         <property name="tmpFolder" value="target/tmp"/>
24         <path id="wikitext.tasks.classpath">
25                 <pathelement path="${compile_classpath}"/>
26         </path>
27         <echo message="compile classpath: ${compile_classpath}"/>
29         <taskdef classpathref="wikitext.tasks.classpath" resource="org/eclipse/mylyn/internal/wikitext/mediawiki/core/tasks/tasks.properties"/>
30         <taskdef classpathref="wikitext.tasks.classpath" resource="org/eclipse/mylyn/wikitext/core/util/anttask/tasks.properties"/>
32         <target name="init">
33                 <mkdir dir="${tmpFolder}"/>
34         </target>
36         <target name="clean" depends="init">
37                 <delete includeemptydirs="true" failonerror="false">
38                         <fileset dir="${tmpFolder}"/>
39                 </delete>
40         </target>
42     <target name="all" depends="init" description="Generate Eclipse help content for the EGit user guide">
43                 <eclipse-wiki-to-help
44                         help.doc.filenamenoextension="EGit User Guide"
45                         help.doc.url.base="${help.doc.url.base}"
46                         help.doc.pageName="EGit/User_Guide"
47                         help.imagefolder="${imageFolder}"
48                         targetfolder="userguide"
49                         wiki.url.base="${help.doc.url.base}/EGit"/>
50                 <replaceregexp file="userguide/EGit User Guide-toc.xml" match="(&lt;topic.*?href=&quot;userguide/Task-Repository-Connectors.html.*?&gt;(\s*&lt;topic\s*href=&quot;.*?&quot;\s*label=&quot;.*&quot;&gt;\s*?&lt;/topic&gt;)+)(\s*)(&lt;/topic&gt;)"
51                                         replace="\1\3&lt;anchor id=&quot;additions-repository-connectors&quot;/&gt;\3\4"
52                                         flags="s"/>
53     </target>
55         <macrodef name="eclipse-wiki-to-help">
56                 <attribute name="help.doc.url.base"/>
57                 <attribute name="wiki.url.base"/>
58                 <attribute name="help.doc.pageName"/>
59                 <attribute name="help.doc.filenameNoExtension"/>
60                 <attribute name="help.imageFolder"/>
61                 <attribute name="targetFolder"/>
62                 <sequential>
63                         <get dest="${tmpFolder}/@{help.doc.filenameNoExtension}.mediawiki" src="@{help.doc.url.base}/index.php?title=@{help.doc.pageName}&amp;action=raw"/>
64                         <echo append="true" file="${tmpFolder}/@{help.doc.filenameNoExtension}.mediawiki">
66 = Updating This Document =
68 This document is maintained in a collaborative wiki.  If you wish to update or modify this document please visit
69 @{help.doc.url.base}/@{help.doc.pageName}
70                         </echo>
72                         <copy todir="${tmpFolder}">
73                                 <fileset dir="userguide/images"/>
74                         </copy>
75                         <mediawiki-fetch-images dest="${tmpFolder}" url="@{help.doc.url.base}" pageName="@{help.doc.pageName}"/>
77                         <wikitext-to-eclipse-help markupLanguage="org.eclipse.mylyn.wikitext.mediawiki.core.MediaWikiLanguage"
78                                 multipleOutputFiles="true"
79                                 navigationImages="true"
80                                 helpPrefix="@{targetFolder}"
81                                 internallinkpattern="@{wiki.url.base}/{0}"
82                                 validate="true"
83                                 failonvalidationerror="true"
84                                 prependImagePrefix="${imageFolder}"
85                                 formatoutput="true"
86                                 defaultAbsoluteLinkTarget="mylyn_external">
87                                 <fileset dir="${tmpFolder}" includes="**/*.mediawiki"/>
88                                 <stylesheet url="book.css"/>
89                         </wikitext-to-eclipse-help>
91                         <mkdir dir="@{targetFolder}/${imageFolder}"/>
92                         <copy todir="@{targetFolder}/${imageFolder}" overwrite="true">
93                                 <fileset dir="${tmpFolder}">
94                                         <include name="*.gif"/>
95                                         <include name="*.png"/>
96                                 </fileset>
97                         </copy>
98                         <copy todir="@{targetFolder}" overwrite="true">
99                                 <fileset dir="${tmpFolder}">
100                                         <include name="*.html"/>
101                                         <include name="*toc.xml"/>
102                                         <exclude name="help.doc.html"/>
103                                 </fileset>
104                         </copy>
105                         <antcall target="test"/>
106                 </sequential>
107         </macrodef>
109         <target name="test" depends="init" description="verify that all of the HTML files are well-formed XML">
110                 <echo level="info">
111 Validating help content XML and HTML files: The Eclipse help system expects well-formed XML
113 If validation fails it is because either:
115 * the userguide source code is poorly formed, or
116 * the WikiText MediaWiki parser has a bug
118 Problems with userguide source are usually caused by improper use of HTML markup in the MediaWiki source,
119 or inadvertently starting a line with a space character (in MediaWiki this starts a preformatted block)
120                 </echo>
122                 <!--
123                 Don't bother with DTD validation: we only care if the files are well-formed.
124                 We therefore provide an empty DTD
125                 -->
126                 <echo file="${tmpFolder}/__empty.dtd" message=""/>
127                 <xmlvalidate lenient="true">
128                         <fileset dir="userguide">
129                                 <include name="**/*.xml"/>
130                         </fileset>
131                         <fileset dir="userguide">
132                                 <include name="**/*.html"/>
133                         </fileset>
134                         <dtd publicid="-//W3C//DTD XHTML 1.0 Transitional//EN" location="${basedir}/${tmpFolder}/__empty.dtd"/>
135                 </xmlvalidate>
136         </target>
137 </project>