This method attaches one or more rnc.PARA_N
elements to the given parent node.
# - - - N a r r a t i v e . w r i t e N o d e
def writeNode ( self, parent ):
"""Output self's content as XML.
"""
Normally the content is a sequence of Paragraph instances. In that case, all we need
to do is to call the .writeNode() method
for each of those instances. See Section 18.4, “Paragraph.writeNode(): Write as
XML”.
When the instance's content is only a single para, we
don't need to wrap the output in a para
element, so we bypass the addition of this node and
directly use Section 18.5, “Paragraph.writeContent(): Write the
content of a paragraph”.
#-- 1 --
if len(self.__paraList) > 1:
#-- 1.1 --
# [ parent := parent with XML added for each element
# of self.__paraList ]
for para in self.__paraList:
para.writeNode ( parent )
elif len(self.__paraList) == 1:
#-- 1.2 --
# [ parent := parent with XML added for the first
# element of self.__paraList ]
solePara = self.__paraList[0]
solePara.writeContent ( parent )