+static void
+add_footnote_page (struct render_pager *p, const struct render_page *body)
+{
+ const struct table *table = body->table;
+ int nc = table_nc (table);
+ int nr = table_nr (table);
+ int footnote_idx = 0;
+ struct tab_table *t;
+ int x, y;
+
+ if (!body->n_footnotes)
+ return;
+
+ t = tab_create (2, body->n_footnotes);
+ for (y = 0; y < nr; y++)
+ for (x = 0; x < nc; )
+ {
+ struct table_cell cell;
+
+ table_get_cell (table, x, y, &cell);
+ if (y == cell.d[V][0])
+ {
+ size_t i;
+
+ for (i = 0; i < cell.n_contents; i++)
+ {
+ const struct cell_contents *cc = &cell.contents[i];
+ size_t j;
+
+ for (j = 0; j < cc->n_footnotes; j++)
+ {
+ const char *f = cc->footnotes[j];
+
+ tab_text (t, 0, footnote_idx, TAB_LEFT, "");
+ tab_footnote (t, 0, footnote_idx, "(none)");
+ tab_text (t, 1, footnote_idx, TAB_LEFT, f);
+ footnote_idx++;
+ }
+ }
+ }
+ x = cell.d[H][1];
+ table_cell_free (&cell);
+ }
+ render_pager_add_table (p, &t->table);
+}
+