# - - - r e p o r t L i n e def reportLine ( flow, depth, sectNode ): '''Format the report block for one section title. [ (flow is an et.Element) and (depth is a nonnegative int) and (sectNode is an et.Element) -> flow +:= a block describing sectNode, indented by depth ] '''
First, extract the section's
Every section should have one, but just in case, we will
spit out some question marks if it doesn't.
#-- 1 # [ if sectNode has an id attribute -> # sectionId := that attribute # else -> # sectionId := "????" ] sectionId = sectNode.attrib.get("id", "????")
Next, find the title node. There had better be one, or we'll display nothing.
#-- 2 # [ if sectNode has a title child -> # titleInline := title text as an FO inline, with # selected elements rendered and the rest ignored # else -> # titleInline := an empty FO inline ] titleNodeList = sectNode.xpath("title") if len(titleNodeList) >= 1: titleInline = renderTitle(titleNodeList) else: titleInline = E.inline()
For the logic that formats the block element and adds it
to the flow, see Section 6.18, “
formatLine(): Assemble one block
in the report body”.
#-- 3 # [ flow +:= a block displaying sectionId and titleInline, # indented by (depth) levels ] formatLine(flow, depth, sectionId, titleInline)