Git Import Wizard
[egit/spearce.git] / org.eclipse.egit.doc / build-help.xml
blobe472488dca652976b6695ac651c1cfaae8751502
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"/>
20         <property name="tmpFolder" value="target/tmp"/>
22         <path id="wikitext.tasks.classpath">
23                 <fileset dir="lib">
24                         <include name="org.eclipse.mylyn.wikitext.*core*.jar"/>
25                 </fileset>
26         </path>
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"/>
31         <target name="init">
32                 <mkdir dir="${tmpFolder}"/>
33         </target>
35         <target name="clean" depends="init">
36                 <delete includeemptydirs="true" failonerror="false">
37                         <fileset dir="${tmpFolder}"/>
38                 </delete>
39         </target>
41     <target name="all" depends="init" description="Generate Eclipse help content for the EGit user guide">
42                 <eclipse-wiki-to-help
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="(&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;)"
50                                         replace="\1\3&lt;anchor id=&quot;additions-repository-connectors&quot;/&gt;\3\4"
51                                         flags="s"/>
52     </target>
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"/>
61                 <sequential>
62                         <get dest="${tmpFolder}/@{help.doc.filenameNoExtension}.mediawiki" src="@{help.doc.url.base}/index.php?title=@{help.doc.pageName}&amp;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}
69                         </echo>
71                         <copy todir="${tmpFolder}">
72                                 <fileset dir="userguide/images"/>
73                         </copy>
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}"
81                                 validate="true"
82                                 failonvalidationerror="true"
83                                 prependImagePrefix="${imageFolder}"
84                                 formatoutput="true"
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"/>
95                                 </fileset>
96                         </copy>
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"/>
102                                 </fileset>
103                         </copy>
104                         <antcall target="test"/>
105                 </sequential>
106         </macrodef>
108         <target name="test" depends="init" description="verify that all of the HTML files are well-formed XML">
109                 <echo level="info">
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)
119                 </echo>
121                 <!--
122                 Don't bother with DTD validation: we only care if the files are well-formed.
123                 We therefore provide an empty DTD
124                 -->
125                 <echo file="${tmpFolder}/__empty.dtd" message=""/>
126                 <xmlvalidate lenient="true">
127                         <fileset dir="userguide">
128                                 <include name="**/*.xml"/>
129                         </fileset>
130                         <fileset dir="userguide">
131                                 <include name="**/*.html"/>
132                         </fileset>
133                         <dtd publicid="-//W3C//DTD XHTML 1.0 Transitional//EN" location="${basedir}/${tmpFolder}/__empty.dtd"/>
134                 </xmlvalidate>
135         </target>
136 </project>