This class inherits from FieldItem, but it
doesn't have a .scanField() method because
the page number comes from the compiler's PageHeader object.
# - - - - - c l a s s P a g e N o F i e l d - - - - -
class PageNoField(FieldItem):
'''Represents a page number field.
Exports: As inherited.
'''
Generic field flattener for a page number. Page numbers are always right-justified in the output field.
# - - - P a g e N o F i e l d . f l a t t e n - - -
@staticmethod
def flatten(pageNoField):
'''Flatten a PageNoField.
'''
if pageNoField is None:
return BLANK_PAGE_NO
else:
return pageNoField.value.rjust(PAGE_NO_L)