def make_all_pages(context, root_box, html, pages):
    """Return a list of laid out pages without margin boxes.

    Re-make pages only if necessary.

    """
    i = 0
    reported_footnotes = None
    page_groups = []
    while True:
        remake_state = context.page_maker[i][-1]
        if (len(pages) == 0 or
                remake_state['content_changed'] or
                remake_state['pages_wanted']):
            PROGRESS_LOGGER.info('Step 5 - Creating layout - Page %d', i + 1)
            # Reset remake_state
            remake_state['content_changed'] = False
            remake_state['pages_wanted'] = False
            remake_state['anchors'] = []
            remake_state['content_lookups'] = []
            page, resume_at = remake_page(i, page_groups, context, root_box, html)
            reported_footnotes = context.reported_footnotes
            yield page
        else:
            PROGRESS_LOGGER.info(
                'Step 5 - Creating layout - Page %d (up-to-date)', i + 1)
            resume_at = context.page_maker[i + 1][0]
            reported_footnotes = None
            yield pages[i]

        i += 1
        if resume_at is None and not reported_footnotes:
            # Throw away obsolete pages and content
            context.page_maker = context.page_maker[:i + 1]
            context.broken_out_of_flow.clear()
            context.reported_footnotes.clear()
            return
Return a list of laid out pages without margin boxes.

Re-make pages only if necessary.
weasyprint/layout/page.py