<?xml version="1.0" encoding="UTF-8" ?>
<rdf:RDF xmlns="http://usefulinc.com/ns/doap#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><Project><name>collective.recipe.sphinxbuilder</name>
<shortdesc>ZC.buildout recipe to generate and build Sphinx-based documentation in the buildout.</shortdesc>
<description>.. contents::

- Code repository: https://svn.plone.org/svn/collective/buildout/collective.recipe.sphinxbuilder/
- Questions and comments to tarek_at_ziade.org


Detailed Documentation
**********************

What is Sphinx ?
================

Sphinx is the rising tool in the Python community to build
documentation. See http://sphinx.pocoo.org.

It is now used for instance by Python. See http://docs.python.org/dev.

Sphinx uses reStructuredText, and can be used to write your buildout-based
application. This recipe sets everything up for you, so you can
provide a nice-looking documentation within your buildout, in static html
or even PDF.

The fact that your documentation is managed like your code
makes it easy to maintain and change it.

Quick start
===========

To use the recipe, add in your buildout configuration file
a section like this::

    [buildout]
    parts =
        ...
        sphinx
        ...
    
    [sphinx]
    recipe = collective.recipe.sphinxbuilder

That's it ! Run your buildout and you will get:

- a new script in the `bin` folder, called  `sphinx`
- a `docs` directory containing your documentation.

To build your documentation, just run the sphinx script::

    $ bin/sphinx

You will get a shiny Sphinx documenation in `docs/build/html`.
To write your documentation, go in `docs/source`.
Everytime source is modified, run the script again.

A good starting point to write your documentation is: http://sphinx.pocoo.org/contents.html.
   
Supported options
=================

The recipe supports the following options:

doc-directory
    Specify the documentation root. Default to `docs`.    

doc-outputs
    Multiple-line value that defines what kind of output to produce. 
    Can be `html`, `latex` or `pdf`. Defaults to `html`.

script-name
    The name of the script generated. Defaults to the name of the section.    

sphinx-project
    The name of the project used in Plone. Defaults to Plone.

sphinx-extensions
    Sphinx extensions in use. Defaults to none. 

sphinx-master 
    Name of the index file. Defaults to index.

sphinx-year
    Year of the project. Defaults to current year.

sphinx-suffix
    File extensions used for reST file. Defaults to .txt

sphinx-author
    Author. Defaults to Plone Community. 

sphinx-version
    Version. Defaults to 1.0.

sphinx-release
    Release. Defaults to 1.0.

sphinx-dot 
    The prefix of the static and template directory.
    Defaults to '.' under Linux and '_' under Windows.

sphinx-sep
    Separate source and build directories. (Y or N) 
    Defaults to Yes.

sphinx-logo 
    Logo used for html and pdf. Defaults to plone.png 
    (which is provided by the recipe)

sphinx-css
    css file used to change Sphinx look. Defaults to 
    plone.css (which is provided by the recipe)

sphinx-latex-options
    extra latex options file used in Sphinx. Defaults to options.tex
    provided by the recipe. 

Example usage
=============

The recipe can be used without any options. We'll start by creating a 
buildout that uses the recipe::

    &gt;&gt;&gt; write('buildout.cfg',
    ... """
    ... [buildout]
    ... parts = sphinx
    ...
    ... [sphinx]
    ... recipe = collective.recipe.sphinxbuilder
    ... """) 

Let's run the buildout::

    &gt;&gt;&gt; print 'start', system(buildout) 
    start...
    Installing sphinx.
    Generated script '/sample-buildout/bin/sphinx-build'.
    &lt;BLANKLINE&gt;

What are we expecting ? 

A `docs` folder with a Sphinx structure::

    &gt;&gt;&gt; docs = join(sample_buildout, 'docs')
    &gt;&gt;&gt; ls(docs)
    - Makefile
    d source

    &gt;&gt;&gt; source = join(docs, 'source')
    &gt;&gt;&gt; ls(source) 
    d  .static
    d  .templates
    -  conf.py
    -  index.txt

    &gt;&gt;&gt; ls(join(source, '.templates'))
    -  layout.html
    -  modindex.html
    -  search.html

    &gt;&gt;&gt; ls(join(source, '.static'))
    -  options.tex
    -  plone.css
    -  plone_logo.png

A script in the `bin` folder to build the docs::

    &gt;&gt;&gt; bin = join(sample_buildout, 'bin')
    &gt;&gt;&gt; ls(bin)
    - buildout
    - sphinx
    - sphinx-build

The content of the script is a simple shell script::

    &gt;&gt;&gt; script = join(sample_buildout, 'bin', 'sphinx')
    &gt;&gt;&gt; print open(script).read()
    cd ...docs
    make html
   
If we want `latex` and `pdf`, we need to explicitly define it::

    &gt;&gt;&gt; write('buildout.cfg',
    ... """
    ... [buildout]
    ... parts = sphinx
    ...
    ... [sphinx]
    ... recipe = collective.recipe.sphinxbuilder
    ... doc-outputs =
    ...     html
    ...     latex
    ...     pdf
    ... """) 
    &gt;&gt;&gt; print 'start', system(buildout)
    start...
    Installing sphinx.
    &lt;BLANKLINE&gt;

Let's see our script now::
    
    &gt;&gt;&gt; print open(script).read() 
    cd ...docs
    make html
    make latex
    make latex &amp;&amp; cd ... &amp;&amp; make

Finally let's run it::

    &gt;&gt;&gt; print 'start', system(script)
    start mkdir -p build/html build/doctrees
    ...
    Transcript written in modPlone.ilg.
    &lt;BLANKLINE&gt;

We should have some nice reST file::

    &gt;&gt;&gt; print open(join(docs, 'source', 'index.txt')).read()
    .. Plone documentation master file, ...
    &lt;BLANKLINE&gt;
    Welcome to Plone's documentation!
    =================================
    &lt;BLANKLINE&gt;
    Contents:
    &lt;BLANKLINE&gt;
    .. toctree::
       :maxdepth: 2
    &lt;BLANKLINE&gt;
    Indices and tables
    ==================
    &lt;BLANKLINE&gt;
    * :ref:`genindex`
    * :ref:`modindex`
    * :ref:`search`
    &lt;BLANKLINE&gt;
    &lt;BLANKLINE&gt;

And the html rendering should use the plone logo::

    &gt;&gt;&gt; html = open(join(docs, 'build', 'html', 'index.html')).read()
    &gt;&gt;&gt; 'plone_logo.png' in html
    True



Contributors
************

Tarek Ziadé, Author


Change history
**************

0.1.1 (2008-09-11)
==================

 - Using a sphinx-build local to the environment [Tarek]

0.1.0 (2008-09-10)
==================

 - Initial implementation [Tarek Ziadé]
 - Created recipe with ZopeSkel [Tarek Ziadé].


Download
********</description>
<homepage rdf:resource="http://svn.plone.org/svn/collective/buildout/collective.recipe.sphinxbuilder/trunk" />
<maintainer><foaf:Person><foaf:name>Tarek Ziadé</foaf:name>
<foaf:mbox_sha1sum>67bd6d2021d55d449b5fda4786eba83a834671f3</foaf:mbox_sha1sum></foaf:Person></maintainer>
<release><Version><revision>0.1.1</revision></Version></release>
</Project></rdf:RDF>