This class encapsulates everything needed to produce the static content for the running head.
Headers contain these elements:
The file's modification timestamp as YYYY-MM-DD HH:MM:SS.
The absolute path to the directory containing the input file.
leader element. The two
leader elements distributed the remaining space in
the running head on either side of the directory path.
The input file's name.
A small space whose size is given in Section 8.20, “
The page number.
Depending on the specific page format, these elements may occur either in “right-hand order,” as above, or in “left-hand order,” with the elements reversed so that the page number is on the left, as with duplex verso pages.
# - - - - - c l a s s H e a d i n g class Heading(object): '''Represents the contents of the running head. Exports: Heading(inputFile): [ (Args() is valid) and (inputFile is an InputFile instance) -> return a new Heading instance representing the header content for Args() and inputFile ] .inputFile: [ as passed to constructor, read-only ] .rightContent(pages, flowName): [ (pages is a page-sequence et.Element) and (flowName is the name of a simpl-page-master) -> pages +:= a new static-content for flowName showing self with the page number on the right side ] .leftContent(pages, flowName): [ (pages is a page-sequence et.Element) and (flowName is the name of a simpl-page-master) -> pages +:= a new static-content for flowName showing self with the page number on the left side ] State/Invariants: .__timestamp: [ modification timestamp for Args().inFileName as "YYYY-MM-DD HH:MM:SS" ] .__pathPart: [ absolute path to directory for Args().inFileName, ending with a '/' ] .__filePart: [ file name part of Args().inFileName ] '''
# - - - H e a d i n g . _ _ i n i t _ _ def __init__(self, inputFile): '''Constructor. ''' #-- 1 self.inputFile = inputFile
The other state items for the instance are derived from the name of the input file: its modification time, directory path name, and file name.
#-- 2 # [ self.__timestamp := as invariant ] self.__getModTime() #-- 3 # [ self.__pathPart := as invariant # self.__filePart := as invariant ] self.__getPaths()