C++, tagnames for Breathe.

See michaeljones/breathe#242.
This commit is contained in:
Jakob Lykke Andersen 2016-03-22 09:09:04 +09:00
parent 150ce21fb3
commit 2b224bec5f

View File

@ -26,7 +26,9 @@ from sphinx.util.pycompat import UnicodeMixin
from sphinx.util.docfields import Field, GroupedField from sphinx.util.docfields import Field, GroupedField
""" """
Important note on ids: Important note on ids
----------------------------------------------------------------------------
Multiple id generation schemes are used due to backwards compatibility. Multiple id generation schemes are used due to backwards compatibility.
- v1: 1.2.3 <= version < 1.3 - v1: 1.2.3 <= version < 1.3
The style used before the rewrite. The style used before the rewrite.
@ -38,6 +40,19 @@ from sphinx.util.docfields import Field, GroupedField
All versions are generated and attached to elements. The newest is used for All versions are generated and attached to elements. The newest is used for
the index. All of the versions should work as permalinks. the index. All of the versions should work as permalinks.
Tagnames
----------------------------------------------------------------------------
Each desc_signature node will have the attribute 'sphinx_cpp_tagname' set to
- 'templateParams', if the line is on the form 'template<...>',
- 'declarator', if the line contains the name of the declared object.
No other desc_signature nodes should exist (so far).
Grammar
----------------------------------------------------------------------------
See http://www.nongnu.org/hcb/ for the grammar, See http://www.nongnu.org/hcb/ for the grammar,
or https://github.com/cplusplus/draft/blob/master/source/grammar.tex or https://github.com/cplusplus/draft/blob/master/source/grammar.tex
for the newest grammar. for the newest grammar.
@ -755,6 +770,7 @@ class ASTTemplateDeclarationPrefix(ASTBase):
_verify_description_mode(mode) _verify_description_mode(mode)
for t in self.templates: for t in self.templates:
templateNode = addnodes.desc_signature() templateNode = addnodes.desc_signature()
templateNode.sphinx_cpp_tagname = 'templateParams'
t.describe_signature(templateNode, 'lastIsName', env, symbol) t.describe_signature(templateNode, 'lastIsName', env, symbol)
signode += templateNode signode += templateNode
@ -2172,6 +2188,7 @@ class ASTDeclaration(ASTBase):
# let's pop it so we can add templates before that # let's pop it so we can add templates before that
parentNode = signode.parent parentNode = signode.parent
mainDeclNode = signode mainDeclNode = signode
mainDeclNode.sphinx_cpp_tagname = 'declarator'
parentNode.pop() parentNode.pop()
assert self.symbol assert self.symbol