Next / Previous / Contents / Shipman's homepage

7.4. fosoxtest: main()

fosoxtest
# - - - - -   m a i n

def main():
    """Main program.
    """
    #-- 1
    # [ s  :=  a new sox.Sox instance that writes to sys.stdout ]
    s = sox.Sox()

    #-- 2
    # [ s  +:=  an open root element
    #   root  :=  a sox.Elt instance representing that element ]
    root = f.root(s)

See Section 7.5, “fosoxtest: buildMasters()”.

fosoxtest
    #-- 3
    # [ s  +:=  a layout-master-set element named REPEAT_MASTER
    #       for double-sided output with odd-page master ODD_MASTER
    #       and even-page master EVEN_MASTER ]
    buildMasters(s)

    #-- 4
    # [ s  +:=  an open page-sequence element for REPEAT_MASTER
    #   pages  :=  a sox.Elt instance representing that element ]
    pages = f.pageSequence(s, REPEAT_MASTER)

See Section 7.6, “fosoxtest: buildStatic() and Section 7.7, “fosoxtest: buildFlow(). After the content has all been generated, close the open page-sequence and root elements and we're done.

fosoxtest
    #-- 5
    # [ s  +:=  static-content elements that set up headers in
    #       regions ODD_BEFORE and EVEN_BEFORE and footers in
    #       regions ODD_AFTER and EVEN_AFTER ]
    buildStatic(s)

    #-- 6
    # [ s  +:=  a flow element containing some sample content ]
    buildFlow(s)

    #-- 7
    # [ s  +:=  (end tag for pages) + (end tag for root) ] 
    pages.end()
    root.end()
    s.cleanup()