summaryrefslogtreecommitdiff
path: root/doc/extdev
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2016-02-14 00:38:27 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2016-02-14 14:49:34 +0900
commit2ec60d59197ffa7e33e820941fd0196e576366be (patch)
treedf17e7e98a848b93d5e621023ad38febccff1eae /doc/extdev
parenta391b1a1db524be0a145fca1955ca95cb952ff36 (diff)
downloadsphinx-git-2ec60d59197ffa7e33e820941fd0196e576366be.tar.gz
Fix #1858: Support numbering custom nodes
Diffstat (limited to 'doc/extdev')
-rw-r--r--doc/extdev/appapi.rst22
1 files changed, 16 insertions, 6 deletions
diff --git a/doc/extdev/appapi.rst b/doc/extdev/appapi.rst
index a7c9f7e9a..b5cb33a33 100644
--- a/doc/extdev/appapi.rst
+++ b/doc/extdev/appapi.rst
@@ -125,12 +125,22 @@ package.
.. versionchanged:: 0.5
Added the support for keyword arguments giving visit functions.
-.. method:: Sphinx.add_enumerable_node(node, figtype, **kwds)
-
- Register a Docutils node class as a numfig target. Sphinx treats the node as
- figure, table or code-block. And then the node is numbered automatically.
-
- *figtype* should be one of ``figure``, ``table`` or ``code-block``.
+.. method:: Sphinx.add_enumerable_node(node, figtype, title_getter=None, **kwds)
+
+ Register a Docutils node class as a numfig target. Sphinx numbers the node
+ automatically. And then the users can refer it using :rst:role:`numref`.
+
+ *figtype* is a type of enumerable nodes. Each figtypes have individual
+ numbering sequences. As a system figtypes, ``figure``, ``table`` and
+ ``code-block`` are defined. It is able to add custom nodes to these
+ default figtypes. It is also able to define new custom figtype if new
+ figtype is given.
+
+ *title_getter* is a getter function to obtain the title of node. It takes
+ an instance of the enumerable node, and it must return its title as string.
+ The title is used to the default title of references for :rst:role:`ref`.
+ By default, Sphinx searches ``docutils.nodes.caption`` or
+ ``docutils.nodes.title`` from the node as a title.
Other keyword arguments are used for node visitor functions. See the
:meth:`Sphinx.add_node` for details.