projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
variable: Simplify var_set_display_width().
[pspp]
/
src
/
output
/
html.c
diff --git
a/src/output/html.c
b/src/output/html.c
index 989752b627fc9c54dcbf59410c5729769a96488c..45c9a1ef730762df544128f488f227568d082517 100644
(file)
--- a/
src/output/html.c
+++ b/
src/output/html.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* 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
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
@@
-55,8
+55,6
@@
struct html_driver
char *command_name;
FILE *file;
size_t chart_cnt;
char *command_name;
FILE *file;
size_t chart_cnt;
-
- bool in_syntax;
};
static const struct output_driver_class html_driver_class;
};
static const struct output_driver_class html_driver_class;
@@
-103,7
+101,7
@@
html_create (const char *file_name, enum settings_output_devices device_type,
html->file = fn_open (html->file_name, "w");
if (html->file == NULL)
{
html->file = fn_open (html->file_name, "w");
if (html->file == NULL)
{
- error (0, errno, _("error opening output file
\"%s\"
"), html->file_name);
+ error (0, errno, _("error opening output file
`%s'
"), html->file_name);
goto error;
}
goto error;
}
@@
-116,8
+114,8
@@
html_create (const char *file_name, enum settings_output_devices device_type,
fputs ("<META http-equiv=\"Content-Style-Type\" content=\"text/css\">\n",
html->file);
fputs ("<META HTTP-EQUIV=\"Content-Type\" "
fputs ("<META http-equiv=\"Content-Style-Type\" content=\"text/css\">\n",
html->file);
fputs ("<META HTTP-EQUIV=\"Content-Type\" "
- "CONTENT=\"text/html; charset=
ISO-8859-1
\">\n", html->file);
- fputs ("<STYLE>\n"
+ "CONTENT=\"text/html; charset=
utf-8
\">\n", html->file);
+ fputs ("<STYLE
TYPE=\"text/css\"
>\n"
"<!--\n"
"body {\n"
" background: white;\n"
"<!--\n"
"body {\n"
" background: white;\n"
@@
-200,11
+198,6
@@
html_destroy (struct output_driver *driver)
if (html->file != NULL)
{
if (html->file != NULL)
{
- if (html->in_syntax)
- {
- fprintf (html->file, "</PRE>\n");
- html->in_syntax = false;
- }
fprintf (html->file,
"</BODY>\n"
"</HTML>\n"
fprintf (html->file,
"</BODY>\n"
"</HTML>\n"
@@
-217,13
+210,6
@@
html_destroy (struct output_driver *driver)
free (html);
}
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)
static void
html_submit (struct output_driver *driver,
const struct output_item *output_item)
@@
-232,12
+218,6
@@
html_submit (struct output_driver *driver,
output_driver_track_current_command (output_item, &html->command_name);
output_driver_track_current_command (output_item, &html->command_name);
- if (html->in_syntax && !is_syntax_item (output_item))
- {
- fprintf (html->file, "</PRE>\n");
- html->in_syntax = false;
- }
-
if (is_table_item (output_item))
{
struct table_item *table_item = to_table_item (output_item);
if (is_table_item (output_item))
{
struct table_item *table_item = to_table_item (output_item);
@@
-253,7
+233,9
@@
html_submit (struct output_driver *driver,
html->chart_cnt++);
if (file_name != NULL)
{
html->chart_cnt++);
if (file_name != NULL)
{
- fprintf (html->file, "<IMG SRC=\"%s\"/>", file_name);
+ const char *title = chart_item_get_title (chart_item);
+ fprintf (html->file, "<IMG SRC=\"%s\" ALT=\"Chart: %s\">",
+ file_name, title ? title : _("No description"));
free (file_name);
}
}
free (file_name);
}
}
@@
-289,14
+271,9
@@
html_submit (struct output_driver *driver,
break;
case TEXT_ITEM_SYNTAX:
break;
case TEXT_ITEM_SYNTAX:
- if (!html->in_syntax)
- {
- fprintf (html->file, "<PRE class=\"syntax\">");
- html->in_syntax = true;
- }
- else
- putc ('\n', html->file);
+ fprintf (html->file, "<PRE class=\"syntax\">");
escape_string (html->file, s, strlen (s), " ");
escape_string (html->file, s, strlen (s), " ");
+ fprintf (html->file, "</PRE>\n");
break;
case TEXT_ITEM_PARAGRAPH:
break;
case TEXT_ITEM_PARAGRAPH:
@@
-418,16
+395,16
@@
html_output_table (struct html_driver *html, struct table_item *item)
alignment = cell.options & TAB_ALIGNMENT;
if (alignment != TAB_LEFT)
alignment = cell.options & TAB_ALIGNMENT;
if (alignment != TAB_LEFT)
- fprintf (html->file, " ALIGN=
%s
",
+ fprintf (html->file, " ALIGN=
\"%s\"
",
alignment == TAB_RIGHT ? "RIGHT" : "CENTER");
colspan = table_cell_colspan (&cell);
if (colspan > 1)
alignment == TAB_RIGHT ? "RIGHT" : "CENTER");
colspan = table_cell_colspan (&cell);
if (colspan > 1)
- fprintf (html->file, " COLSPAN=
%d
", colspan);
+ fprintf (html->file, " COLSPAN=
\"%d\"
", colspan);
rowspan = table_cell_rowspan (&cell);
if (rowspan > 1)
rowspan = table_cell_rowspan (&cell);
if (rowspan > 1)
- fprintf (html->file, " ROWSPAN=
%d
", rowspan);
+ fprintf (html->file, " ROWSPAN=
\"%d\"
", rowspan);
/* Cell borders. */
n_borders = 0;
/* Cell borders. */
n_borders = 0;