+static void
+add_footnote_page (struct render_pager *p, const struct table_item *item)
+{
+ const struct footnote **f;
+ size_t n_footnotes = table_collect_footnotes (item, &f);
+ if (!n_footnotes)
+ return;
+
+ struct table *t = table_create (1, n_footnotes, 0, 0, 0, 0);
+
+ for (size_t i = 0; i < n_footnotes; i++)
+ {
+ table_text_format (t, 0, i, 0, "%s. %s", f[i]->marker, f[i]->content);
+ table_add_style (t, 0, i, f[i]->style);
+ }
+ render_pager_add_table (p, t, 0);
+
+ free (f);
+}
+
+static void
+add_text_page (struct render_pager *p, const struct table_item_text *t,
+ int min_width)
+{
+ if (!t)
+ return;
+
+ struct table *tab = table_create (1, 1, 0, 0, 0, 0);
+ table_text (tab, 0, 0, 0, t->content);
+ for (size_t i = 0; i < t->n_footnotes; i++)
+ table_add_footnote (tab, 0, 0, t->footnotes[i]);
+ if (t->style)
+ tab->styles[0] = table_area_style_clone (tab->container, t->style);
+ render_pager_add_table (p, tab, min_width);
+}
+
+static void
+add_layers_page (struct render_pager *p,
+ const struct table_item_layers *layers, int min_width)
+{
+ if (!layers)
+ return;
+
+ struct table *tab = table_create (1, layers->n_layers, 0, 0, 0, 0);
+ for (size_t i = 0; i < layers->n_layers; i++)
+ {
+ const struct table_item_layer *layer = &layers->layers[i];
+ table_text (tab, 0, i, 0, layer->content);
+ for (size_t j = 0; j < layer->n_footnotes; j++)
+ table_add_footnote (tab, 0, i, layer->footnotes[j]);
+ }
+ if (layers->style)
+ tab->styles[0] = table_area_style_clone (tab->container, layers->style);
+ render_pager_add_table (p, tab, min_width);
+}
+