This is a utility function used to attach the various
child elements in the sighting-notes pattern.
# - - - S i g h t N o t e s . w r i t e C h i l d
def writeChild(self, parent, childName, narr):
"""Attach a child and put narrative into it.
[ (parent is an et.Element) and
(childName is an element name as a string) and
(narr is a Narrative instance or None) ->
if narr is not None ->
parent := parent with a new child named (childName)
attached, containing narr ]
else -> I ]
"""
#-- 1 --
if narr is None:
return
#-- 2 --
# [ parent := parent with a new childName child added
# child := that new child ]
child = et.SubElement(parent, childName)
See Section 18.6, “Narrative.writeNode(): Write as XML”.
#-- 3 --
# [ child := child with narr added ]
narr.writeNode(child)