Skip to content

Commit

Permalink
src/doc/en/developer: Document how to conditionalize portions of the …
Browse files Browse the repository at this point in the history
…manual
  • Loading branch information
mkoeppe committed Oct 7, 2023
1 parent 4fc966f commit 748f9c9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/doc/en/developer/packaging_sage_library.rst
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,17 @@ requiring all of Sage to be present.
mechanism mentioned above can also be used for this.


Dependencies of the Sage documentation
--------------------------------------

The documentation will not be modularized.

However, some parts of the Sage reference manual may depend on functionality
provided by optional packages. These portions of the reference manual
should be conditionalized using the Sphinx directive ``.. only ::``,
as explained in :ref:`section-documentation-conditional`.


Version constraints of dependencies
-----------------------------------

Expand Down
26 changes: 26 additions & 0 deletions src/doc/en/developer/sage_manuals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,32 @@ procedure is different:
* Add your file to the index contained in
``SAGE_ROOT/src/doc/en/reference/combinat/module_list.rst``.

.. _section-documentation-conditional:

Making portions of the reference manual conditional on optional features
========================================================================

For every dynamically detectable feature such as :class:`graphviz
<~sage.features.graphviz.Graphviz>` or :class:`sage.symbolic
<sage.features.sagemath.sage__symbolic>` (see :mod:`sage.features`),
Sage defines a Sphinx tag that can be used with the `Sphinx
directive ".. only::"
<https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#tags>`_.
Because Sphinx tags have to use Python identifier syntax, Sage uses
the format ``feature_``, followed by the feature name where dots are
replaced by underscores. Hence, conditionalizing on the features of
the previous examples would look as follows:

.. CODE-BLOCK:: rest
.. only:: feature_graphviz
and:

.. CODE-BLOCK:: rest
.. only:: feature_sage_symbolic
.. _section-building-manuals:

Building the manuals
Expand Down

0 comments on commit 748f9c9

Please sign in to comment.