2009-06-25 03:26:07 +05:30
|
|
|
Installation and building the docs
|
|
|
|
==================================
|
|
|
|
|
|
|
|
You need to install sphinx. Assuming you have installed the python setuptools, just do:
|
|
|
|
|
2014-09-29 23:21:38 +05:30
|
|
|
sudo easy_install sphinx
|
|
|
|
or
|
|
|
|
sudo pip install sphinx
|
2009-06-25 03:26:07 +05:30
|
|
|
|
|
|
|
Once installed, go to the docs directory, and do:
|
|
|
|
|
|
|
|
make html
|
|
|
|
|
|
|
|
Which will produce the html output in docs/_build/html
|
|
|
|
|
|
|
|
|
2009-08-23 03:15:34 +05:30
|
|
|
Documentation Guidelines
|
2009-06-25 03:26:07 +05:30
|
|
|
=======================
|
|
|
|
|
|
|
|
Doc strings in python files should be written in reStructured text: http://docutils.sourceforge.net/docs/user/rst/quickref.html
|
|
|
|
|
2014-09-29 23:21:38 +05:30
|
|
|
The typical docstring for Gramps should look like this:
|
2009-06-25 03:26:07 +05:30
|
|
|
|
|
|
|
"""Brief synopsis
|
|
|
|
|
|
|
|
This is a longer explanation, which may include *italics* or **bold**, or
|
|
|
|
a link to another method :meth:`~gen.lib.person.Person.get_handle`
|
|
|
|
Then, you need to provide optional subsection in this order (just to be
|
|
|
|
consistent and have a uniform documentation, nothing prevent you to switch
|
|
|
|
the order).
|
|
|
|
|
|
|
|
:param arg1: the first value
|
|
|
|
:type arg1: int or float or :class:`~gen.lib.baseobj.BaseObject`
|
|
|
|
:param arg2: the second value
|
|
|
|
:type arg2: int or float
|
|
|
|
:param arg3: the third value
|
|
|
|
|
|
|
|
:returns: arg1/arg2 +arg3
|
|
|
|
:rtype: float, this is the return type
|
|
|
|
|
|
|
|
|
|
|
|
:Examples:
|
|
|
|
|
|
|
|
>>> import template
|
|
|
|
>>> a = MainClass()
|
|
|
|
>>> a.function2(1,1,1)
|
|
|
|
2
|
|
|
|
|
|
|
|
:note:
|
|
|
|
can be useful to emphasize
|
|
|
|
important feature
|
|
|
|
|
|
|
|
:See Also:
|
|
|
|
:class:`MainClass1`
|
|
|
|
|
|
|
|
:Warnings:
|
|
|
|
arg2 must be non-zero.
|
|
|
|
|
|
|
|
:Todo:
|
|
|
|
check that arg2 is non zero.
|
|
|
|
"""
|
|
|
|
|
2009-08-23 03:15:34 +05:30
|
|
|
For a class, use :cvar variable: for class variable, :ivar variable: for instance class
|
2009-06-25 03:26:07 +05:30
|
|
|
variable, .. attribute:: attribute: for attributes, ....
|
2015-08-22 05:58:08 +05:30
|
|
|
See http://sphinx-doc.org/markup/ and http://sphinx-doc.org/markup/inline.html
|
2009-06-25 03:26:07 +05:30
|
|
|
|
|
|
|
Tips and Tricks
|
|
|
|
===============
|
|
|
|
Change in many files something:
|
|
|
|
|
|
|
|
perl -pi -w -e "s/L{PersonRef}/:class:\`\~gen.lib.personref.PersonRef\`/g;" *.py
|
|
|
|
|
|
|
|
here L{PersonRef} is changed in :class:`~gen.lib.personref.PersonRef
|
2014-09-29 23:21:38 +05:30
|
|
|
`
|