Skip to content

Commit

Permalink
Merge branch 'parblock' of https://github.com/utzig/breathe
Browse files Browse the repository at this point in the history
  • Loading branch information
vermeeren committed Dec 3, 2020
2 parents 986ad33 + 11e6745 commit 089426b
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 2 deletions.
19 changes: 19 additions & 0 deletions breathe/parser/compound.py
Original file line number Diff line number Diff line change
Expand Up @@ -1050,12 +1050,31 @@ def buildChildren(self, child_, nodeName_):
obj_ = supermod.docAnchorType.factory()
obj_.build(child_)
self.content.append(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == "parblock":
obj_ = supermod.docParBlockType.factory()
obj_.build(child_)
self.content.append(obj_)


supermod.docParaType.subclass = docParaTypeSub
# end class docParaTypeSub


class docParBlockTypeSub(supermod.docParBlockType):

node_type = "docparblock"

def __init__(self, para=None):
supermod.docParBlockType.__init__(self, para)

def buildChildren(self, child_, nodeName_):
supermod.docParBlockType.buildChildren(self, child_, nodeName_)


supermod.docParBlockType.subclass = docParBlockTypeSub
# end class docParBlockTypeSub


class docMarkupTypeSub(supermod.docMarkupType):

node_type = "docmarkup"
Expand Down
66 changes: 66 additions & 0 deletions breathe/parser/compoundsuper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5682,6 +5682,72 @@ def buildChildren(self, child_, nodeName_):
# end class docCharType


class docParBlockType(GeneratedsSuper):
subclass = None
superclass = None
def __init__(self, mixedclass_=None, para=None):
if mixedclass_ is None:
self.mixedclass_ = MixedContainer
else:
self.mixedclass_ = mixedclass_
if para is None:
self.para = []
else:
self.para = para
def factory(*args_, **kwargs_):
if docParBlockType.subclass:
return docParBlockType.subclass(*args_, **kwargs_)
else:
return docParBlockType(*args_, **kwargs_)
factory = staticmethod(factory)
def get_para(self): return self.para
def set_para(self, para): self.para = para
def add_para(self, value): self.para.append(value)
def insert_para(self, index, value): self.para[index] = value
def export(self, outfile, level, namespace_='', name_='docParBlockType', namespacedef_=''):
showIndent(outfile, level)
outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
self.exportAttributes(outfile, level, namespace_, name_='docParBlockType')
if self.hasContent_():
outfile.write('>\n')
self.exportChildren(outfile, level + 1, namespace_, name_)
showIndent(outfile, level)
outfile.write('</%s%s>\n' % (namespace_, name_))
else:
outfile.write('/>\n')
def exportAttributes(self, outfile, level, namespace_='', name_='docParBlockType'):
pass
def exportChildren(self, outfile, level, namespace_='', name_='docParBlockType'):
for para_ in self.para:
para_.export(outfile, level, namespace_, name_='para')
def hasContent_(self):
if (
self.para
):
return True
else:
return False
def build(self, node_):
attrs = node_.attributes
self.buildAttributes(attrs)
self.valueOf_ = ''
for child_ in node_.childNodes:
nodeName_ = child_.nodeName.split(':')[-1]
self.buildChildren(child_, nodeName_)
def buildAttributes(self, attrs):
pass
def buildChildren(self, child_, nodeName_):
if child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'para':
obj_ = docParaType.factory()
obj_.build(child_)
obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
MixedContainer.TypeNone, 'para', obj_)
self.para.append(obj_)

# end class docParBlockType


class docEmptyType(GeneratedsSuper):
subclass = None
superclass = None
Expand Down
4 changes: 4 additions & 0 deletions breathe/renderer/sphinxrenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,9 @@ def visit_docpara(self, node) -> List[Node]:

return [nodes.paragraph("", "", *nodelist)]

def visit_docparblock(self, node) -> List[Node]:
return self.render_iterable(node.para)

def visit_docimage(self, node) -> List[Node]:
"""Output docutils image node using name attribute from xml as the uri"""

Expand Down Expand Up @@ -1934,6 +1937,7 @@ def dispatch_memberdef(self, node) -> List[Node]:
"docreftext": visit_docreftext,
"docheading": visit_docheading,
"docpara": visit_docpara,
"docparblock": visit_docparblock,
"docimage": visit_docimage,
"docurllink": visit_docurllink,
"docmarkup": visit_docmarkup,
Expand Down
8 changes: 8 additions & 0 deletions documentation/source/doxygen.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ Par
.. doxygenindex::
:path: ../../examples/doxygen/par/xml

Parblock
--------

.. cpp:namespace:: @ex_doxygen_parblock

.. doxygenindex::
:path: ../../examples/doxygen/parblock/xml

Overload
--------

Expand Down
1 change: 1 addition & 0 deletions examples/doxygen/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ mux
overload
page
par
parblock
pyexample
qtstyle
relates
Expand Down
7 changes: 5 additions & 2 deletions examples/doxygen/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ all: class/xml/index.xml \
relates/xml/index.xml \
author/xml/index.xml \
par/xml/index.xml \
parblock/xml/index.xml \
overload/xml/index.xml \
example/xml/index.xml \
include/xml/index.xml \
Expand All @@ -49,7 +50,7 @@ all: class/xml/index.xml \

clean:
rm -rf class define enum file func page relates author \
par overload example include qtstyle jdstyle structcmd \
par parblock overload example include qtstyle jdstyle structcmd \
autolink tag restypedef afterdoc template tag group diagrams \
memgrp docstring pyexample mux manual interface

Expand Down Expand Up @@ -80,6 +81,9 @@ author/xml/index.xml: author.cpp author.cfg
par/xml/index.xml: par.cpp par.cfg
$(DOXYGEN) par.cfg

parblock/xml/index.xml: parblock.cpp parblock.cfg
$(DOXYGEN) parblock.cfg

overload/xml/index.xml: overload.cpp overload.cfg
$(DOXYGEN) overload.cfg

Expand Down Expand Up @@ -140,4 +144,3 @@ diagrams/xml/index.xml: diagrams_a.h diagrams_b.h diagrams_c.h diagrams_d.h diag
ifneq ($(HAVE_DOT),)
$(DOXYGEN) diagrams.cfg
endif

11 changes: 11 additions & 0 deletions examples/doxygen/parblock.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
PROJECT_NAME = "Parblock Command"
OUTPUT_DIRECTORY = parblock
GENERATE_LATEX = NO
GENERATE_MAN = NO
GENERATE_RTF = NO
CASE_SENSE_NAMES = NO
INPUT = parblock.cpp
QUIET = YES
JAVADOC_AUTOBRIEF = YES
GENERATE_HTML = NO
GENERATE_XML = YES
24 changes: 24 additions & 0 deletions examples/doxygen/parblock.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*! \class Test15
* Normal text.
*
* \par A paragraph followed by a paragraph block:
* \parblock
* Contents of the first paragraph in the block.
*
* New paragraph under the same heading.
* \endparblock
*
* \note
* This note consists of three paragraphs in a block.
* \parblock
* This is the first paragraph in the block.
*
* And this is the second paragraph in the block.
*
* And still a third paragraph in the block.
* \endparblock
*
* More normal text.
*/

class Test15 {};

0 comments on commit 089426b

Please sign in to comment.