Rereading a few patch, I've found a bunch of systematically wrong Sphinx
markup. Just to make sure, let me recall a few fact about ReST and Sphinx.
First of all, when I'm unsure of a markup, I found [1] quite helpful as well
as concise. When a more advanced markup is needed I often use [2] and [3].
Now here is a random and non exhaustive lists of common mistakes:
1 - Do NOT indent bullet lists (unless you want extra indentation) and leave a
blank line at the end as
"""
INPUT:
- ``self`` -- bla bla
- ``opts`` -- ...
More text
"""
and not
"""
INPUT:
- ``self`` -- bla bla
- ``opts`` -- ...
More text
"""
2 - with multi-line explicit markup (note, warning, rubric, seealso...), the
following alignment must be respected
"""
.. seealso:: :class:`FinitePosets`, :class:`Lattices`,
:class:func:`LatticePoset`
"""
and not
"""
.. seealso:: :class:`FinitePosets`, :class:`Lattices`,
:class:func:`LatticePoset`
"""
3 - When using LaTeX markup (`...`) make sure to prefix the docstring with a r
to prevent control character expansion:
r"""
\right is not interpreted as \r + right
"""
Actually, I think that we should systematically prefix docstring with r.
4 - equation need not extra quote as in
r"""
.. math:: x\leq y \Rightarrow f(x) \leq f(y)
"""
and not
r"""
.. math:: `x\leq y \Rightarrow f(x) \leq f(y)`
"""
I hope this helps,
Florent
[1] http://docutils.sourceforge.net/docs/user/rst/quickref.html
[2] http://sphinx.pocoo.org/markup/index.html
[3] http://docutils.sourceforge.net/rst.html
> There is another quite common mistake:
>
> It should be
> EXAMPLE::
>
> sage: bla
>
> and not
>
> EXAMPLE:
> sage: bla
Sure ! I thought this one was too basic...
> Just to avoid duplication of work: We killed a bunch of those mistakes
> in #9976.
Thanks !!! To avoid endless problem with rebasing sage-combinat queue, It
could really help if this patch could be the first one of a release (say
4.7.1)...
Cheers,
Florent
Even if you get used to doing it, it's a big pain due to the amount of
time it takes. As requested, it was added to the patchbot, and this
step alone takes more time than rebuilding the entire Sage library
plus running all the tests (i.e. in real time, the patchbot spends the
majority of its time running Sphinx). We really need to find a way to
speed this up, parallelizing it an otherwise.
- Robert
Is there a way of forcing Sphinx to reject these, so we find them? A C compiler
should not allow one to compile code that has syntax errors, so why should Sphinx?
Dave
+1 on the S to EXAMPLES. And, when not obvious, +1 on having a
description of the intention of the example is doing.
On the other hand, there is no point in adding a sentence like "We
here give an interesting example", as it does not bring any
information: EXAMPLES by itself tells we are going to give an example;
and as a doc writer, one should strive at choosing interesting
examples anyway, but one can't decide for the reader whether (s)he
will actually find it interesting.
Cheers,
Nicolas
--
Nicolas M. Thi�ry "Isil" <nth...@users.sf.net>
http://Nicolas.Thiery.name/