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

10.27. hist.cgi: foStatic(): Add running headers and footers

hist.cgi
# - - -   f o S t a t i c

def foStatic(s):
    '''Add running headers and footers.

      [ s is a sox.Sox instance ->
          s  +:=  static content for headers in regions lib.ODD_BEFORE
                  and lib.EVEN_BEFORE ]
    '''

In the current version, there is no footer, just a completely generic running head: “Christmas Bird Count history report”. If only one circle were selected, we might use something like “Caballo (NM) Christmas Bird Count history, 1949–1966”; but what if multiple circles are selected? This enhancement will be postponed until a better idea shows up.

For the odd-page heading, a leader element fills the space between the heading on the left (see Section 13.10.8, “GENERIC_HEADER) and the page number on the right.

hist.cgi
    #-- 1
    # [ s  +:=  a static-content element setting up the running
    #       header for region lib.ODD_BEFORE ]
    oddHeader = fo.staticContent(s, lib.ODD_BEFORE)
    b = foHeader(s)
    s.write(lib.GENERIC_HEADER)
    fo.leader(s)
    s.leaf("page-number")
    b.end()
    oddHeader.end()

On even pages, page number on the outside.

hist.cgi
    #-- 2
    # [ s  +:=  a static-content element setting up the running
    #       header for region lib.EVEN_BEFORE ]
    evenHeader = fo.staticContent(s, lib.EVEN_BEFORE)
    b = foHeader(s)    
    s.leaf("page-number")
    fo.leader(s)
    s.write(lib.GENERIC_HEADER)
    b.end()
    evenHeader.end()