Next / Previous / Contents / Shipman's homepage

19. conditionalMaster(): Generate a conditional master reference

See Section 4.13, “conditionalMaster(): One rule about when to use a page master”.

fohelpers.py
# - - -   c o n d i t i o n a l M a s t e r

def conditionalMaster ( masterRef, pagePos=None, oddEven=None,
                        blankNon=None):
    '''Create a conditional-page-master-reference.

      [ (masterRef is the name of the referenced master) and
        (pagePos is "first", "rest", "last", defaulting
        to no page position test) and
        (oddEven is "odd" or "even", defaulting to no test) and
        (blankNon is "blank" or "non-blank", defaulting to no test) ->
            return a new conditional-page-master-reference element
            with those values ]
    '''
    node = E("conditional-page-master-reference",
             dash(masterReference=masterRef))
    if pagePos:
        node.attrib["page-position"] = pagePos
    if oddEven:
        node.attrib["odd-or-even"] = oddEven
    if blankNon:
        node.attrib["blank-or-not-blank"] = blankNon
    return node