# - - - f o R e n d e r C h i l d def foRenderChild(foNode, docNode): '''Render one DocBook element and its tail. [ (foNode is an FO container as an et.Element) and (docNode is a DocBook node as an et.Element) -> foNode := foNode + (child rendered as FO with selected markup) + child.tail ] '''
markupMap, the dictionary that relates
DocBook elements to FO inline styles, see Section 6.10, “
renderTitle(): Remove tags from a
title element. Test case:
ABCD”. If the DocBook node's tag is a
key in this dictionary, we will create a new
inline child element to
whose style is taken from the corresponding value in
not one of the rendered elements, no inline is created.
In either case,
foDest specifies the
element to which the rendered content of
docNode will be added.
#-- 1 # [ if docNode.tag is a key in markupMap -> # foNode := foNode with a new inline added whose style # comes from markupMap[docNode.tag] # foDest := that new inline # else -> # foDest := foNode ] try: style = markupMap[docNode.tag] foDest = subElement(foNode, h.inline(style)) except KeyError: foDest = foNode
Next comes a recursive call to Section 6.11, “
foRenderContent(): Render text and
descendants into FO”, which renders only the
content (text and child elements) of
#-- 2 # [ foDest := foDest + (docNode.text if any) + # (descendants of docNode with selected markup) ] foRenderContent(foDest, docNode)
Finally, we must add the
.tail text of
docNode to the output. If no children
were added to
foNode in the previous step
foNode had no rendered
descendants), that text will be added to the
.text attribute of
If any children were added, the text will be added
.tail attribute of the last child.
#-- 3 # [ if foNode has any children -> # foNode := foNode with docNode.tail added to its # last child # else -> # foNode.text +:= docNode.tail ] addText(foNode, docNode.tail)