Next / Previous / Contents / Shipman's homepage

16. wrapFlow: Add a styling block-container

listext2
# - - -   w r a p F l o w

def wrapFlow(flow):
    '''Add a block-container to wrap the main flow

      [ (Args() is valid) and
        (flow is an et.Element) ->
          flow  +:=  a block-container that styles its child blocks
                     as specified by bodyLayout and Args()
          return that block-container ]
    '''

The block-container generated here wraps all the block elements that display the output lines. Most of the attributes on this element are static; see Section 8.24, “WRAPPER_PROPS for those. We also set up the font size here, to be inherited by the child blocks.

listext2
    #-- 1
    # [ flow   +:=  a new block-container with attributes WRAPPER_PROPS,
    #               and font size str(Args().pointSize in points ]
    #   wrapper  :=  that new block-container ]
    wrapper = subElement(flow,
        E('block-container', WRAPPER_PROPS,
          h.dash(fontSize="{0}pt".format(Args().pointSize))))

    #-- 2
    return wrapper