Skip to content

Commit

Permalink
Merge branch 'section' of https://github.com/utzig/breathe
Browse files Browse the repository at this point in the history
  • Loading branch information
vermeeren committed Feb 13, 2021
2 parents 3c6d13d + 576b1c5 commit e6e66de
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 18 deletions.
30 changes: 15 additions & 15 deletions breathe/parser/compoundsuper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2888,6 +2888,10 @@ def __init__(self, id=None, title=None, para=None, sect2=None, internal=None, mi
self.content_ = []
else:
self.content_ = content_
if title is None:
self.title = ""
else:
self.title = title
def factory(*args_, **kwargs_):
if docSect1Type.subclass:
return docSect1Type.subclass(*args_, **kwargs_)
Expand Down Expand Up @@ -2943,11 +2947,7 @@ def buildAttributes(self, attrs):
def buildChildren(self, child_, nodeName_):
if child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'title':
childobj_ = docTitleType.factory()
childobj_.build(child_)
obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
MixedContainer.TypeNone, 'title', childobj_)
self.content_.append(obj_)
self.title = child_.childNodes[0].nodeValue
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'para':
childobj_ = docParaType.factory()
Expand Down Expand Up @@ -2989,6 +2989,10 @@ def __init__(self, id=None, title=None, para=None, sect3=None, internal=None, mi
self.content_ = []
else:
self.content_ = content_
if title is None:
title = ""
else:
title = title
def factory(*args_, **kwargs_):
if docSect2Type.subclass:
return docSect2Type.subclass(*args_, **kwargs_)
Expand Down Expand Up @@ -3044,11 +3048,7 @@ def buildAttributes(self, attrs):
def buildChildren(self, child_, nodeName_):
if child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'title':
childobj_ = docTitleType.factory()
childobj_.build(child_)
obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
MixedContainer.TypeNone, 'title', childobj_)
self.content_.append(obj_)
self.title = child_.childNodes[0].nodeValue
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'para':
childobj_ = docParaType.factory()
Expand Down Expand Up @@ -3090,6 +3090,10 @@ def __init__(self, id=None, title=None, para=None, sect4=None, internal=None, mi
self.content_ = []
else:
self.content_ = content_
if title is None:
self.title = ""
else:
self.title = title
def factory(*args_, **kwargs_):
if docSect3Type.subclass:
return docSect3Type.subclass(*args_, **kwargs_)
Expand Down Expand Up @@ -3145,11 +3149,7 @@ def buildAttributes(self, attrs):
def buildChildren(self, child_, nodeName_):
if child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'title':
childobj_ = docTitleType.factory()
childobj_.build(child_)
obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
MixedContainer.TypeNone, 'title', childobj_)
self.content_.append(obj_)
self.title = child_.childNodes[0].nodeValue
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'para':
childobj_ = docParaType.factory()
Expand Down
19 changes: 16 additions & 3 deletions breathe/renderer/sphinxrenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1344,8 +1344,19 @@ def visit_docmarkup(self, node) -> List[Node]:
print("Warning: does not currently handle 'small' text display")
return [creator("", "", *nodelist)]

def visit_docsect1(self, node) -> List[Node]:
return []
def visit_docsectN(self, node) -> List[Node]:
'''
Docutils titles are defined by their level inside the document so
the proper structure is only guaranteed by the Doxygen XML.
Doxygen command mapping to XML element name:
@section == sect1, @subsection == sect2, @subsubsection == sect3
'''
section = nodes.section()
section['ids'].append(node.id)
section += nodes.title(node.title, node.title)
section += self.render_iterable(node.content_)
return [section]

def visit_docsimplesect(self, node) -> List[Node]:
"""Other Type documentation such as Warning, Note, Returns, etc"""
Expand Down Expand Up @@ -2016,7 +2027,9 @@ def dispatch_memberdef(self, node) -> List[Node]:
"docimage": visit_docimage,
"docurllink": visit_docurllink,
"docmarkup": visit_docmarkup,
"docsect1": visit_docsect1,
"docsect1": visit_docsectN,
"docsect2": visit_docsectN,
"docsect3": visit_docsectN,
"docsimplesect": visit_docsimplesect,
"doctitle": visit_doctitle,
"docformula": visit_docformula,
Expand Down

0 comments on commit e6e66de

Please sign in to comment.