X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fhtml.c;h=60ca95e28dba029683e895dad42e0a7aac91c2a1;hb=5ce9c6ba1502e623ec6723a8273da77e5858b8d4;hp=e79cd8afea34180dfa279dc2ff6adfc0f98aa38f;hpb=f4bd801640ccaf1d41f45e0206e01e71d3e18604;p=pspp
diff --git a/src/output/html.c b/src/output/html.c
index e79cd8afea..60ca95e28d 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,51 +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, " ", "",
- file_name, title ? title : _("No description"));
- free (file_name);
+ char *file_name = xr_draw_png_chart (item->chart,
+ html->chart_file_name,
+ html->chart_cnt++,
+ &html->fg, &html->bg);
+ if (file_name != NULL)
+ {
+ const char *title = chart_get_title (item->chart);
+ fprintf (html->file, "
",
+ file_name, title ? title : _("No description"));
+ free (file_name);
+ }
}
- }
-#endif /* HAVE_CAIRO */
- else if (is_text_item (output_item))
- {
- struct text_item *text_item = to_text_item (output_item);
- const char *s = text_item_get_text (text_item);
+ break;
- switch (text_item_get_type (text_item))
- {
- case TEXT_ITEM_TITLE:
- print_title_tag (html->file, "H1", s);
- break;
-
- case TEXT_ITEM_SUBTITLE:
- print_title_tag (html->file, "H2", s);
- break;
+ case OUTPUT_ITEM_GROUP:
+ for (size_t i = 0; i < item->group.n_children; i++)
+ html_submit__ (driver, item->group.children[i], level + 1);
+ break;
- case TEXT_ITEM_COMMAND_OPEN:
- fprintf (html->file, "
");
- 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->chart_cnt);
+ 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, message_item->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 (layers, 0, y, &cell); + cell.d[H][1] = body->n[H]; + html_put_table_cell (html, pt, &cell, "td", NULL); + + fputs (" |
---|---|