A function to run on every page after creation.
The function takes one argument, the newly generated page. Functions will typically create objects with this page as their parent.
simple_header_footerfor a ready-made simple overlay function.
- class neoscore.core.page_supplier.PageSupplier
A supplier and generator-on-demand of document
This acts like a list of
Pageobjects which generates them as needed. Externally, it can be used mostly as a list. If an index is requested for which no page yet exists, that page will be generated, as well as any missing pages between the previous last page and the one requested. Consequently, keep in mind that innocent looking operations such as
page_supplerare actually expensive operations, as they implicitly generate thousands of Page objects.
The contents of the
PageSuppliershould be treated as immutable. Attempts to modify the pages it contains will likely result in unexpected behavior.
This is an internal class meant to be created by the global
- __init__(document: Document, overlay_func: Optional[PageOverlayFunc] = None)
document – The global document using this object.
overlay_func – A function to call with every page when generated. This can be used to create headers and footers.