Contribute documentation


Writing documentation for Apache Ivy™ is pretty simple.

The documentation engine used is called xooki, and allows to edit pages while you browse them as soon as you browse them offline (and thus can actually save your modifications).

To browse the doc offline, we recommend to check it out from git:
git clone https://git-wip-us.apache.org/repos/asf/ant-ivy.git
Alternatively you can also check out the whole site:
svn co https://svn.apache.org/repos/asf/ant/site/ivy ivy-site
Then open the index.html file, and you will browse the web site exactly as when you're online, except that you will see a small toolbar at the upper right, allowing to edit the page, save it, move the page in the TOC, create a child, and so on:



Inline editing

When you choose edit you will see a pretty familiar textbox where you can edit the page source.



The source uses a format very familiar to those who sometimes write html. Indeed nearly any html is allowed. But you also have some shortcuts and neat syntax.

First, line breaks are automatically recognized, so you don't have to put br everywhere.
Another interesting thing is the code fragment:
<code>
any text including <tags/>
</code>
Very helpful to avoid escaping all xml with lt and gt.

Finally, URLs are automatically recognized and convert to links, jira issues like IVY-202 are recognized too, and you can use a neat format to reference any ant ivy ant task like install. And you can also link to another page by providing its id (i.e. its url without the base and the .html) like the Home or the history/latest-milestone/index.

Feel free to edit this page to get a good overview of what is possible.

And do not forget to save your changes before leaving the page! Then you can use your favorite IDE or git and compute a patch for what you changed, and submit this patch by attaching it to a jira issue, or simply sending it to the ivy-dev mailing list.

Editing the TOC

The structure of the TOC is stored in the toc.json. Some operations are available in the toolbar, others need manual editing of the json file.

Moving entries

To move up or down an entry within its category, you can use the arrows in the toolbar. First go on the page you want to move and then use the arrows ( ). Note that the changes are directly done in the json file, there is no need to trigger some "save" action.

Adding entries

You can also add an entry to the TOC via the toolbar, but only as a child of an existing entry. Select the parent, and use the button. Then you will be asked for a title (displayed to the end user) and a path (the path of the html file on the filesystem, relative to the root).

To add a root entry to the TOC, open the toc.json file with your favorite editor. In the root "children" array, add your entry:
      {
"id":"mydir/myfilename",
"title":"My title",
"children": [

]
},
And create an HTML file mydir/myfilename.html with:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<html>
<head>
<script type="text/javascript">var xookiConfig = {level: 0};</script>

</head>
<body>
<textarea id="xooki-source">
</textarea>
<script type="text/javascript">xooki.postProcess();</script>
</body>
</html>
And finally reload the index.html in your favorite browser, the new entry will appear. You can now add some content by editing the page.

Abstract Entries

Some entries in the tree of the TOC can be abstract. Such kind of node does not link to any page, but holds some children. So a node will appear in the tree, with an arrow to display or hide the children, but there is no html links associated, as there is no page to display.

To specify a such node, edit the toc.json and set the "isAbstract" property to true:
           {
"id":"myAbstractID",
"title":"My Abstract Node",
"isAbstract":true,
"children":
.......
}

External TOC reference

It is possible to not have the entire documentation in one place. This is particularly useful for the versioning of some documentation. So the end user will see an unified tree whereas every information is not stored in the toc.json.

So you have to define a node with the 3 following properties:
  • "title": the title of the imported entry
  • "importRoot": the relative path to the root of the external TOC (where to find the other toc.json)
  • "importNode": the ID of node in the external TOC to point to.
For instance:
{
"title":"My doc version 1.2.3",
"importRoot":"history/1.2.3",
"importNode":"index"
},

External URL

A entry in the toc can point to an arbitrary URL rather than on a page identified by its id.

To make an entry point to an external URL, just add an url property:
{
"id":"external-search"
"title":"Some www search engine",
"url":"http://www.google.com/"
},

Known issues

There is a special xml tag used by Xooki to handle the inline edition of the content: textarea with id xooki-source. In the current page we had to include that special tag. So in the source of this page there would be two tags with the same id "xooki-source", which is forbidden. So we have to xml encode it in the source, with some &lt; and &gt;.

There also an issue with some json code. Above there are some json code which has to be xml encoded unless Xooki got confused. So [ and ] have to be encoded into respectively &#x5B; and &#x5D;.

And there are some xml encoding issues while inline editing. Generally you don't need to xml encode them, Xooki will handle it for you. But as discussed above, sometimes you are forced to use some. So as you may see the source of this page, xml entities are encoded 3 times. If you want to display an xml encoded & then you will have to write &amp;amp;amp;.
IMPORTANT NOTE: if you edit a page with Xooki which has some xml entities, Xooki will eat them and the triple encoding will disappear. Before saving you have to be sure to re-encode the & of the entities two times: in the page you will see &#x5D; which has to be replaced by &amp;amp;#x5D;. The simpler though is to edit this kind of file via a text editor and not a browser.