.. _doc-guidelines:

************************
Documentation Guidelines
************************

Once you have successfully programmed an entirely working plug-in or module, you may be willing to help others who will look into your code, searching for drops of knowledge and smart tips to reach the application goals. At this point, a documentation can become the lighthouse in the raging wild ocean of your code.

As you can suspect, we actually can not force you to choose a documentation solution over another one, or even force you to create a documentation, however, we if you are ready to do so, we can provide you with some enlightment on how we proceed on our own. We think a more unified help is less destabilizing for the new-comers and also much appreciated by the regular users.

.. _doc_sphinx:

Sphinx
======

Formerly written with Docbook, the current documentation has been entirely remanied in order to ease the whole documentation redaction process, using a more friendly and understandable base syntax with the Sphinx Documentation Generator.

Sphinx is a free tool using the python programming language. The output format can be in HTML or in pdf (among others) offering the possibility to generate off- and online documentation at the same time.

The generator manages the cross-references and link building processes automatically, creating tree of content, download links or image integration in a blink of an eye. The whole generated documentation can then be customize using a standard css file.

   
.. _doc_sphinx_install:

Installation
------------

All the steps you needed to follow for installing the tool are described on the `Sphinx project official website <http://sphinx-doc.org/index.html>`_. 

The entire process is trivial, however, you will need a python interpreter in order to use the tool.

If you ever encounter any bug or problem, please pass through the Sphinx channels to get the appropriate assistance.


.. _doc_sphinx_creation:

Create a new documentation
--------------------------

Sphinx proposes a very helpful script called *sphinx-quickstart* creating everything you need to begin your documentation. Here again, the Sphinx website, and especially the `First Steps with Sphinx section <http://sphinx-doc.org/tutorial.html>`_ is more than qualified to give you the proper explanations.


.. _doc_doxygen:

Doxygen
=======

*Doxygen* is a documentation system for several languages like C++. It can generate an on-line documentation browser (in HTML), a set of manpages, an off-line reference manual (in LaTeX) and/or others from the set of documented source files of your project. This kind of documentation is a necessary tool for developers to find informations about the code. It is not a way to explain how it is implemented but which possibilities you have. Doxygen is available for the most common OS and distributions like Windows, MacOs, Debian, Gentoo...
	

.. _doc_doxygen_install:

Installation
------------

Being widely used, there is a good chance *Doxygen* is already installed on your system if you are using a Unix/Linux OS. If the tool is not present, you can follow the steps described in the `installation page <http://www.stack.nl/~dimitri/doxygen/manual/install.html>`_ of the `Doxygen website <http://www.stack.nl/~dimitri/doxygen>`_.

For the *Tulip* project, two distinct documentations are generated. One is destinated for the Developer team and this other one is for the user of the librairies. The Configuration files are generated by the Makefile processing.


.. _doc_doxygen_creation:

Create a new documentation
--------------------------
        
Before starting using Doxygen, you must have a project you want to document. The source code should be commented using the `special comment blocks <http://www.stack.nl/~dimitri/doxygen/manual/docblocks.html#specialblock>`_ recognizable by Doxygen.

Once you have written the appropriate comments, you will only need to create the configuration file and run Doxygen to generate the documents. Those steps are detailled `on this page <http://www.stack.nl/~dimitri/doxygen/manual/starting.html>`_.

  
	

.. _dow-faqs:

Doxygen FAQ
-----------

* How to insert a block of code ?

To illustrate your documentation, you can insert a block of code in a description between *\code* and *\endcode*. This code is written in the documentation with highlighting syntax.

* How to force an end of line ?

Use the tag *\n*.

* How to make doxygen ignore code fragment ?

It exists two ways to resolve this questions. The first one is to use the tags *\cond* and *\endcond* to skip the internal code. The second way is to use the preprocessor of Doxygen. In the configuration file, you specify the macros and you verify if the value of *PREPROCESSING* is to yes. Then, you set *MACROS_NAME* to *PREDEFINED*. ::

  #ifndef MACROS_NAME

    /* code that must be skipped by Doxygen */

  #endif /* MACROS_NAME */

Two macros are defines for *Tulip* documentations.
            
  * *DOXYGEN_NOTFOR_DEVEL* : use to skip the code for Developer and User documentations.
  * *DOXYGEN_NOTFOR_USER* : use just for the User documentation.
            
* How to insert an equation ?

See the `appropriate section <http://www.stack.nl/~dimitri/doxygen/formulas.html>`_ in the Doxygen website. Doxygen allows you to put Latex formulas in the ouput (just for HTML and latex format). Three ways are avaible. If you want to include formulas in-text, you have to put formulas between a pair of *\f$* ::

  \f$ AB = \sqrt{BC^2 + CA^2} \f$

The second way is for a centered display on a seperate line. These formulas should be put between :: 

  \f[

and ::

  \f]

commands.

The third way is to used formulas or other latex elements that are not in a math environment. It can be specified using ::

  \f{environment}

where *environment* is the latex environment, the corresponding end commands is ::

  \f}

