Next / Previous / Contents / TCC Help System / NM Tech homepage

10.25. hist.cgi: foMasters(): Set up the XSL-FO page layout

hist.cgi
# - - -   f o M a s t e r s

def foMasters(s):
    '''Set up the page layout.

      [ s is a sox.Sox instance ->
          s  +:=  a layout-master-set subtree for letter paper,
                  duplex printing, named lib.REPEAT_MASTER ]
    '''

First we start the layout-master-set element.

hist.cgi
    #-- 1
    # [ s  +:=  an open layout-master-set element
    #   layout  :=  that element ]
    layout = fo.layoutMasterSet(s)

Next, the odd- and even-page masters. See Section 10.26, “hist.cgi: simpleMaster().

hist.cgi
    #-- 2
    # [ s  +:=  (a simple-page-master named lib.ODD_MASTER with dimensions
    #       lib.ODD_DIMS and header region lib.ODD_BEFORE) + (a
    #       simple-page-master named lib.EVEN_MASTER with dimensions
    #       lib.EVEN_DIMS and header region lib.EVEN_BEFORE) ]
    simpleMaster(s, lib.ODD_MASTER, lib.ODD_DIMS, lib.ODD_BEFORE)
    simpleMaster(s, lib.EVEN_MASTER, lib.EVEN_DIMS, lib.EVEN_BEFORE)

The rest is pro forma, and says to use the odd master on odd pages and the even master on even pages.

hist.cgi
    #-- 3
    # [ s  +:=  a page-sequence-master named lib.REPEAT_MASTER
    #       that uses lib.ODD_MASTER on odd pages and lib.EVEN_MASTER
    #       on even pages ]
    seqMaster = fo.pageSequenceMaster(s, lib.REPEAT_MASTER)
    masterAlts = fo.repeatablePageMasterAlternatives(s)
    fo.conditionalPageMasterReference(s, lib.ODD_MASTER, oddOrEven="odd")
    fo.conditionalPageMasterReference(s, lib.EVEN_MASTER, oddOrEven="even")
    masterAlts.end()
    seqMaster.end()

    #-- 4
    # [ s  +:=  layout, closed ]
    layout.end()