Next / Previous / Contents / Shipman's homepage

11. buildMasters(): Set up the page formats

listext2
# - - -   b u i l d M a s t e r s

def buildMasters(tree, bodyLayout):
    '''Create the children of the layout-master-set

      [ (tree is an h.FlowTree instance) and
        (bodyLayout is a BodyLayout instance) ->
          tree.masters  +:=  (one or two simple-page-master
              subtrees as per bodyLayout) + (a page-sequence-master
              named REPEAT_MASTER as per bodyLayout) ]
    '''

See Section 12, “buildSimpleMaster(): Build one simple-page-master for the logic that creates a simple-page-master. We create one for simplex output, two for duplex.

listext2
    #-- 1
    # [ tree.masters  +:=  a new simple-page-master named
    #       ODD_MASTER representing the odd-page layout of bodyLayout,
    #       with before and after regions ODD_BEFORE and ODD_AFTER ]
    tree.masters.append(buildSimpleMaster(bodyLayout.oddDims,
        ODD_MASTER, ODD_BEFORE, ODD_AFTER))

    #-- 2
    # [ if Args().duplex ->
    #     tree.masters  +:=  a new simple-page-master named
    #     EVEN_MASTER  representing the even-page layout of bodyLayout,
    #     with before and after regions EVEN_BEFORE and EVEN_AFTER ]
    #   else -> I ]
    if Args().duplex:
        tree.masters.append(buildSimpleMaster(bodyLayout.evenDims,
        EVEN_MASTER, EVEN_BEFORE, EVEN_AFTER))

    #-- 3
    # [ tree.masters  +:=  a page-sequence-master representing Args()
    #                      and bodyLayout ]
    buildPageSequenceMaster(tree, bodyLayout)