X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fhtml.c;fp=src%2Foutput%2Fhtml.c;h=9e7f567a27274866efda6d67fddef2ca74082d3c;hb=8dd405d0900f29f69e54726a79045c119146de89;hp=715682a9ea02087a92f4857938a4106b9ead7da3;hpb=7ee8dbfc15aa4580c2132e53b64f13815fc93c62;p=pspp diff --git a/src/output/html.c b/src/output/html.c index 715682a9ea..9e7f567a27 100644 --- a/src/output/html.c +++ b/src/output/html.c @@ -373,16 +373,35 @@ put_border (FILE *file, int n_borders, int style, const char *border_name) style == TAL_1 ? "thin solid" : "double"); } +static void +put_tfoot (struct html_driver *html, const struct table *t, bool *tfoot) +{ + if (!*tfoot) + { + fprintf (html->file, "", table_nc (t)); + *tfoot = true; + } + else + fputs ("\n
", html->file); +} + static void html_output_table (struct html_driver *html, const struct table_item *item) { const struct table *t = table_item_get_table (item); const char *title = table_item_get_title (item); + const char *caption = table_item_get_caption (item); int footnote_idx = 0; + bool tfoot = false; int y; fputs ("", html->file); + if (caption) + { + put_tfoot (html, t, &tfoot); + escape_string (html->file, caption, strlen (caption), " ", "
"); + } footnote_idx = 0; for (y = 0; y < table_nr (t); y++) { @@ -405,11 +424,7 @@ html_output_table (struct html_driver *html, const struct table_item *item) { char marker[16]; - if (!footnote_idx) - fprintf (html->file, "\n", html->file); - footnote_idx = 0; - } + if (tfoot) + fputs ("\n", html->file); + footnote_idx = 0; fputs ("\n", html->file);
", - table_nc (t)); - else - fputs ("\n
", html->file); + put_tfoot (html, t, &tfoot); str_format_26adic (++footnote_idx, false, marker, sizeof marker); fprintf (html->file, "%s ", marker); escape_string (html->file, c->footnotes[i], @@ -420,11 +435,9 @@ html_output_table (struct html_driver *html, const struct table_item *item) table_cell_free (&cell); } } - if (footnote_idx) - { - fputs ("