X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fhtml.c;h=77d4195f30c2a2e5319a8192701736964c2feb51;hb=fbed9cb6fdc9ca4d1c85a1b8138fedb0451a3aaa;hp=5aec959c740a16a69888d9f5da76ad2d56778528;hpb=a258e53c63a08b0ec48aea8f03808eb651729424;p=pspp diff --git a/src/output/html.c b/src/output/html.c index 5aec959c74..77d4195f30 100644 --- a/src/output/html.c +++ b/src/output/html.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2009, 2010, 2011 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 @@ -56,7 +56,8 @@ struct html_driver FILE *file; size_t chart_cnt; - bool in_syntax; + bool css; + bool borders; }; static const struct output_driver_class html_driver_class; @@ -93,6 +94,8 @@ html_create (const char *file_name, enum settings_output_devices device_type, d = &html->driver; output_driver_init (&html->driver, &html_driver_class, file_name, device_type); + html->css = parse_boolean (opt (d, o, "css", "true")); + html->borders = parse_boolean (opt (d, o, "borders", "true")); html->file_name = xstrdup (file_name); html->chart_file_name = parse_chart_file_name (opt (d, o, "charts", @@ -113,62 +116,66 @@ html_create (const char *file_name, enum settings_output_devices device_type, fputs ("\n", html->file); print_title_tag (html->file, "TITLE", _("PSPP Output")); fprintf (html->file, "\n", version); - fputs ("\n", - html->file); fputs ("\n", html->file); - fputs ("\n", - html->file); + + if ( html->css) + { + fputs ("\n", + html->file); + fputs ("\n", + html->file); + } fputs ("\n", html->file); fputs ("file); fputs (" LINK=\"#1f00ff\" ALINK=\"#ff0000\" VLINK=\"#9900dd\">\n", html->file); @@ -200,11 +207,6 @@ html_destroy (struct output_driver *driver) if (html->file != NULL) { - if (html->in_syntax) - { - fprintf (html->file, "\n"); - html->in_syntax = false; - } fprintf (html->file, "\n" "\n" @@ -217,13 +219,6 @@ html_destroy (struct output_driver *driver) free (html); } -static bool -is_syntax_item (const struct output_item *item) -{ - return (is_text_item (item) - && text_item_get_type (to_text_item (item)) == TEXT_ITEM_SYNTAX); -} - static void html_submit (struct output_driver *driver, const struct output_item *output_item) @@ -232,12 +227,6 @@ html_submit (struct output_driver *driver, output_driver_track_current_command (output_item, &html->command_name); - if (html->in_syntax && !is_syntax_item (output_item)) - { - fprintf (html->file, "\n"); - html->in_syntax = false; - } - if (is_table_item (output_item)) { struct table_item *table_item = to_table_item (output_item); @@ -291,14 +280,9 @@ html_submit (struct output_driver *driver, break; case TEXT_ITEM_SYNTAX: - if (!html->in_syntax) - { - fprintf (html->file, "
");
-              html->in_syntax = true;
-            }
-          else
-            putc ('\n', html->file);
+          fprintf (html->file, "
");
           escape_string (html->file, s, strlen (s), " ");
+          fprintf (html->file, "
\n"); break; case TEXT_ITEM_PARAGRAPH: @@ -431,33 +415,36 @@ html_output_table (struct html_driver *html, struct table_item *item) if (rowspan > 1) fprintf (html->file, " ROWSPAN=\"%d\"", rowspan); - /* Cell borders. */ - n_borders = 0; + if (html->borders) + { + /* Cell borders. */ + n_borders = 0; - top = table_get_rule (t, TABLE_VERT, x, y); - if (top > TAL_GAP) - put_border (html->file, n_borders++, top, "top"); - - if (y == table_nr (t) - 1) - { - bottom = table_get_rule (t, TABLE_VERT, x, y + 1); - if (bottom > TAL_GAP) - put_border (html->file, n_borders++, bottom, "bottom"); - } - - left = table_get_rule (t, TABLE_HORZ, x, y); - if (left > TAL_GAP) - put_border (html->file, n_borders++, left, "left"); - - if (x == table_nc (t) - 1) - { - right = table_get_rule (t, TABLE_HORZ, x + 1, y); - if (right > TAL_GAP) - put_border (html->file, n_borders++, right, "right"); - } - - if (n_borders > 0) - fputs ("\"", html->file); + top = table_get_rule (t, TABLE_VERT, x, y); + if (top > TAL_GAP) + put_border (html->file, n_borders++, top, "top"); + + if (y == table_nr (t) - 1) + { + bottom = table_get_rule (t, TABLE_VERT, x, y + 1); + if (bottom > TAL_GAP) + put_border (html->file, n_borders++, bottom, "bottom"); + } + + left = table_get_rule (t, TABLE_HORZ, x, y); + if (left > TAL_GAP) + put_border (html->file, n_borders++, left, "left"); + + if (x == table_nc (t) - 1) + { + right = table_get_rule (t, TABLE_HORZ, x + 1, y); + if (right > TAL_GAP) + put_border (html->file, n_borders++, right, "right"); + } + + if (n_borders > 0) + fputs ("\"", html->file); + } putc ('>', html->file);