- if (csv->titles)
- csv_output_table_cell (csv, table_item_get_title (table_item), "Table");
-
- for (y = 0; y < t->n[TABLE_VERT]; y++)
- {
- for (x = 0; x < t->n[TABLE_HORZ]; x++)
- {
- struct table_cell cell;
-
- table_get_cell (t, x, y, &cell);
-
- if (x > 0)
- fputs (csv->separator, csv->file);
-
- if (x != cell.d[TABLE_HORZ][0] || y != cell.d[TABLE_VERT][0])
- csv_output_field (csv, "");
- else
- csv_output_table_cell (csv, &cell, NULL);
- }
- putc ('\n', csv->file);
- }
-
- if (csv->captions)
- csv_output_table_cell (csv, table_item_get_caption (table_item),
- "Caption");
-
- struct footnote **f;
- size_t n_footnotes = table_collect_footnotes (table_item, &f);
- if (n_footnotes)
- {
- fputs ("\nFootnotes:\n", csv->file);
-
- for (size_t i = 0; i < n_footnotes; i++)
- {
- csv_output_field (csv, f[i]->marker);
- fputs (csv->separator, csv->file);
- csv_output_field (csv, f[i]->content);
- putc ('\n', csv->file);
- }
-
- free (f);
- }
- }
- else if (is_text_item (output_item))
- {
- const struct text_item *text_item = to_text_item (output_item);
- enum text_item_type type = text_item_get_type (text_item);
- const char *text = text_item_get_text (text_item);
-
- if (type == TEXT_ITEM_SYNTAX || type == TEXT_ITEM_PAGE_TITLE)
- return;