X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Foutput%2Fhtml.c;h=d3049e6564bd95e5c925a99a605c7bb2e96cd8a8;hb=95cde62bdf5210c1c60dad5598a888b864f93161;hp=6e5181d7da0340134942749643f05d7cede98c3b;hpb=b9aea813e643c3badd9a9fe7a8b396088b30c96e;p=pspp
diff --git a/src/output/html.c b/src/output/html.c
index 6e5181d7da..d3049e6564 100644
--- a/src/output/html.c
+++ b/src/output/html.c
@@ -1,5 +1,6 @@
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2009, 2010, 2011, 2012, 2013, 2014, 2017 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2009, 2010, 2011, 2012, 2013, 2014, 2017,
+ 2020 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -22,52 +23,56 @@
#include ");
- case TEXT_ITEM_SUBHEAD:
- print_title_tag (html->file, "H4", s);
- break;
+ char *s = msg_to_string (item->message);
+ escape_string (html->file, s, " ", "
");
- fprintf (html->file, "\">");
- print_title_tag (html->file, "H3", s);
- break;
+ case OUTPUT_ITEM_IMAGE:
+ if (html->chart_file_name)
+ {
+ char *file_name = xr_write_png_image (
+ item->image, html->chart_file_name, ++html->n_charts);
+ if (file_name != NULL)
+ {
+ fprintf (html->file, "", file_name);
+ free (file_name);
+ }
+ }
+ break;
- case TEXT_ITEM_COMMAND_CLOSE:
- fprintf (html->file, "
");
+ free (s);
- case TEXT_ITEM_SYNTAX:
- fprintf (html->file, "");
- escape_string (html->file, s, strlen (s), " ", "
\n");
- break;
+ fprintf (html->file, "
");
- fprintf (html->file, "
*/
- break;
+ case OUTPUT_ITEM_TABLE:
+ html_output_table (html, item);
+ break;
- case TEXT_ITEM_BLANK_LINE:
- fputs ("
", html->file);
- break;
+ case OUTPUT_ITEM_TEXT:
+ {
+ char *s = text_item_get_plain_text (item);
- case TEXT_ITEM_EJECT_PAGE:
- /* Nothing to do. */
- break;
+ switch (item->text.subtype)
+ {
+ case TEXT_ITEM_PAGE_TITLE:
+ break;
- case TEXT_ITEM_COMMENT:
- case TEXT_ITEM_ECHO:
- /* We print out syntax anyway, so nothing to do here either. */
- break;
- }
- }
- else if (is_message_item (output_item))
- {
- const struct message_item *message_item = to_message_item (output_item);
- const struct msg *msg = message_item_get_msg (message_item);
- char *s = msg_to_string (msg, html->command_name);
- print_title_tag (html->file, "P", s);
- free (s);
+ case TEXT_ITEM_TITLE:
+ {
+ char tag[3] = { 'H', MIN (5, level) + '0', '\0' };
+ print_title_tag (html->file, tag, s);
+ }
+ break;
+
+ case TEXT_ITEM_SYNTAX:
+ fprintf (html->file, "");
+ escape_string (html->file, s, " ", "
\n");
+ break;
+
+ case TEXT_ITEM_LOG:
+ fprintf (html->file, "
");
+ fprintf (html->file, "
");
+ escape_string (html->file, s, " ", "
");
+ fprintf (html->file, "
or | tag. */
- is_header = (y < table_ht (t)
- || y >= table_nr (t) - table_hb (t)
- || x < table_hl (t)
- || x >= table_nc (t) - table_hr (t));
- tag = is_header ? "TH" : "TD";
- fprintf (html->file, " <%s", tag);
-
- alignment = (cell.n_contents > 0
- ? cell.contents[0].options & TAB_ALIGNMENT
- : TAB_LEFT);
- if (alignment != TAB_LEFT)
- fprintf (html->file, " ALIGN=\"%s\"",
- alignment == TAB_RIGHT ? "RIGHT" : "CENTER");
-
- colspan = table_cell_colspan (&cell);
- if (colspan > 1)
- fprintf (html->file, " COLSPAN=\"%d\"", colspan);
-
- rowspan = table_cell_rowspan (&cell);
- if (rowspan > 1)
- fprintf (html->file, " ROWSPAN=\"%d\"", rowspan);
-
- if (html->borders)
- {
- /* Cell borders. */
- n_borders = 0;
-
- top = table_get_rule (t, TABLE_VERT, x, y);
- if (top > TAL_0)
- put_border (html->file, n_borders++, top, "top");
-
- if (y + rowspan == table_nr (t))
- {
- bottom = table_get_rule (t, TABLE_VERT, x, y + rowspan);
- if (bottom > TAL_0)
- put_border (html->file, n_borders++, bottom, "bottom");
- }
-
- left = table_get_rule (t, TABLE_HORZ, x, y);
- if (left > TAL_0)
- put_border (html->file, n_borders++, left, "left");
-
- if (x + colspan == table_nc (t))
- {
- right = table_get_rule (t, TABLE_HORZ, x + colspan, y);
- if (right > TAL_0)
- put_border (html->file, n_borders++, right, "right");
- }
-
- if (n_borders > 0)
- fputs ("\"", html->file);
- }
-
- putc ('>', html->file);
-
- /* Output cell contents. */
- for (c = cell.contents; c < &cell.contents[cell.n_contents]; c++)
+ table_get_cell (body, x, y, &cell);
+ if (x == cell.d[TABLE_HORZ][0] && y == cell.d[TABLE_VERT][0])
{
- const char *s = c->text;
- int i;
-
- if (c->options & TAB_EMPH)
- fputs ("", html->file);
- if (c->options & TAB_FIX)
- {
- fputs ("", html->file);
- escape_string (html->file, s, strlen (s), " ", " "); - fputs ("", html->file); - } - else - { - s += strspn (s, CC_SPACES); - escape_string (html->file, s, strlen (s), " ", " "); - } - if (c->options & TAB_EMPH) - fputs ("", html->file); - - if (c->n_footnotes > 0) - { - fputs ("", html->file); - for (i = 0; i < c->n_footnotes; i++) - { - char marker[16]; - - if (i > 0) - putc (',', html->file); - str_format_26adic (++footnote_idx, false, - marker, sizeof marker); - fputs (marker, html->file); - } - fputs ("", html->file); - } + bool is_header = (y < body->h[V][0] + || y >= body->n[V] - body->h[V][1] + || x < body->h[H][0] + || x >= body->n[H] - body->h[H][1]); + const char *tag = is_header ? "th" : "td"; + html_put_table_cell (html, pt, &cell, tag, body); } - /* Output | or . */
- fprintf (html->file, "%s>\n", tag);
-
- next_1:
x = cell.d[TABLE_HORZ][1];
- table_cell_free (&cell);
}
- fputs ("
---|---|