Implement Team->Add to Index action
[egit.git] / org.eclipse.egit.doc / build-help.xml
blob3498cfc99b37284589773cfae939e69e53f9a194
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
8     Contributors:
9          Chris Aniszczyk - initial API and implementation
10  -->
12 <project name="org.eclipse.egit.doc" default="all">
13     <description>
14             Generate Eclipse help content for the EGit user guide
15     </description>
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"/>
21         <path id="wikitext.tasks.classpath">
22                 <fileset dir="lib">
23                         <include name="org.eclipse.mylyn.wikitext.*core*.jar"/>
24                 </fileset>
25         </path>
27         <taskdef classpathref="wikitext.tasks.classpath" resource="org/eclipse/mylyn/internal/wikitext/mediawiki/core/tasks/tasks.properties"/>
28         <taskdef classpathref="wikitext.tasks.classpath" resource="org/eclipse/mylyn/wikitext/core/util/anttask/tasks.properties"/>
30         <target name="init">
31                 <mkdir dir="tmp"/>
32         </target>
34         <target name="clean" depends="init">
35                 <delete includeemptydirs="true" failonerror="false">
36                         <fileset dir="tmp"/>
37                 </delete>
38         </target>
40     <target name="all" depends="init" description="Generate Eclipse help content for the EGit user guide">
41                 <eclipse-wiki-to-help
42                         help.doc.filenamenoextension="EGit User Guide"
43                         help.doc.url.base="${help.doc.url.base}"
44                         help.doc.pageName="EGit/User_Guide"
45                         help.imagefolder="${imageFolder}"
46                         targetfolder="userguide"
47                         wiki.url.base="${help.doc.url.base}/EGit"/>
48                 <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;)"
49                                         replace="\1\3&lt;anchor id=&quot;additions-repository-connectors&quot;/&gt;\3\4"
50                                         flags="s"/>
51     </target>
53         <macrodef name="eclipse-wiki-to-help">
54                 <attribute name="help.doc.url.base"/>
55                 <attribute name="wiki.url.base"/>
56                 <attribute name="help.doc.pageName"/>
57                 <attribute name="help.doc.filenameNoExtension"/>
58                 <attribute name="help.imageFolder"/>
59                 <attribute name="targetFolder"/>
60                 <sequential>
61                         <get dest="tmp/@{help.doc.filenameNoExtension}.mediawiki" src="@{help.doc.url.base}/index.php?title=@{help.doc.pageName}&amp;action=raw"/>
62                         <echo append="true" file="tmp/@{help.doc.filenameNoExtension}.mediawiki">
64 = Updating This Document =
66 This document is maintained in a collaborative wiki.  If you wish to update or modify this document please visit
67 @{help.doc.url.base}/@{help.doc.pageName}
68                         </echo>
70                         <copy todir="tmp">
71                                 <fileset dir="images"/>
72                         </copy>
73                         <mediawiki-fetch-images dest="tmp" url="@{help.doc.url.base}" pageName="@{help.doc.pageName}"/>
75                         <wikitext-to-eclipse-help markupLanguage="org.eclipse.mylyn.wikitext.mediawiki.core.MediaWikiLanguage"
76                                 multipleOutputFiles="true"
77                                 navigationImages="true"
78                                 helpPrefix="@{targetFolder}"
79                                 internallinkpattern="@{wiki.url.base}/{0}"
80                                 validate="true"
81                                 failonvalidationerror="true"
82                                 prependImagePrefix="${imageFolder}"
83                                 formatoutput="true"
84                                 defaultAbsoluteLinkTarget="mylyn_external">
85                                 <fileset dir="tmp" includes="**/*.mediawiki"/>
86                                 <stylesheet url="book.css"/>
87                         </wikitext-to-eclipse-help>
89                         <mkdir dir="@{targetFolder}/${imageFolder}"/>
90                         <copy todir="@{targetFolder}/${imageFolder}" overwrite="true">
91                                 <fileset dir="tmp">
92                                         <include name="*.gif"/>
93                                         <include name="*.png"/>
94                                 </fileset>
95                         </copy>
96                         <copy todir="@{targetFolder}" overwrite="true">
97                                 <fileset dir="tmp">
98                                         <include name="*.html"/>
99                                         <include name="*toc.xml"/>
100                                         <exclude name="help.doc.html"/>
101                                 </fileset>
102                         </copy>
103                         <antcall target="test"/>
104                 </sequential>
105         </macrodef>
107         <target name="test" depends="init" description="verify that all of the HTML files are well-formed XML">
108                 <echo level="info">
109 Validating help content XML and HTML files: The Eclipse help system expects well-formed XML
111 If validation fails it is because either:
113 * the userguide source code is poorly formed, or
114 * the WikiText MediaWiki parser has a bug
116 Problems with userguide source are usually caused by improper use of HTML markup in the MediaWiki source,
117 or inadvertently starting a line with a space character (in MediaWiki this starts a preformatted block)
118                 </echo>
120                 <!--
121                 Don't bother with DTD validation: we only care if the files are well-formed.
122                 We therefore provide an empty DTD
123                 -->
124                 <echo file="tmp/__empty.dtd" message=""/>
125                 <xmlvalidate lenient="true">
126                         <fileset dir="userguide">
127                                 <include name="**/*.xml"/>
128                         </fileset>
129                         <fileset dir="userguide">
130                                 <include name="**/*.html"/>
131                         </fileset>
132                         <dtd publicid="-//W3C//DTD XHTML 1.0 Transitional//EN" location="${basedir}/tmp/__empty.dtd"/>
133                 </xmlvalidate>
134         </target>
135 </project>