pivot-table: Implement hiding footnotes.
[pspp] / src / output / html.c
index e865642a6e518d9bb47e3afb00f8f1600631c90e..644ef49eba9e84082141fc1d5ef1cbb917eb9231 100644 (file)
@@ -33,9 +33,7 @@
 #include "libpspp/i18n.h"
 #include "libpspp/message.h"
 #include "libpspp/version.h"
-#ifdef HAVE_CAIRO
 #include "output/cairo-chart.h"
-#endif
 #include "output/chart-item.h"
 #include "output/driver-provider.h"
 #include "output/image-item.h"
 struct html_driver
   {
     struct output_driver driver;
-#ifdef HAVE_CAIRO
     struct cell_color fg;
     struct cell_color bg;
-#endif
     struct file_handle *handle;
     char *chart_file_name;
 
@@ -202,10 +198,8 @@ html_create (struct file_handle *fh, enum settings_output_devices device_type,
                                                       fh_get_file_name (fh)));
   html->file = NULL;
   html->chart_cnt = 1;
-#ifdef HAVE_CAIRO
   html->bg = parse_color (opt (d, o, "background-color", "#FFFFFFFFFFFF"));
   html->fg = parse_color (opt (d, o, "foreground-color", "#000000000000"));
-#endif
   html->file = fn_open (html->handle, "w");
   if (html->file == NULL)
     {
@@ -266,7 +260,6 @@ html_submit (struct output_driver *driver,
       struct table_item *table_item = to_table_item (output_item);
       html_output_table (html, table_item);
     }
-#ifdef HAVE_CAIRO
   else if (is_image_item (output_item) && html->chart_file_name != NULL)
     {
       struct image_item *image_item = to_image_item (output_item);
@@ -296,7 +289,6 @@ html_submit (struct output_driver *driver,
           free (file_name);
         }
     }
-#endif  /* HAVE_CAIRO */
   else if (is_text_item (output_item))
     {
       struct text_item *text_item = to_text_item (output_item);
@@ -594,16 +586,20 @@ html_put_table_cell (struct html_driver *html, const struct pivot_table *pt,
   if (cell->value->n_footnotes > 0)
     {
       fputs ("<sup>", html->file);
+      size_t n_footnotes = 0;
       for (size_t i = 0; i < cell->value->n_footnotes; i++)
         {
-          if (i > 0)
-            putc (',', html->file);
+          const struct pivot_footnote *f
+            = pt->footnotes[cell->value->footnote_indexes[i]];
+          if (f->show)
+            {
+              if (n_footnotes++ > 0)
+                putc (',', html->file);
 
-          size_t idx = cell->value->footnote_indexes[i];
-          const struct pivot_footnote *f = pt->footnotes[idx];
-          char *marker = pivot_value_to_string (f->marker, pt);
-          escape_string (html->file, marker, " ", "<br>");
-          free (marker);
+              char *marker = pivot_footnote_marker_string (f, pt);
+              escape_string (html->file, marker, " ", "<br>");
+              free (marker);
+            }
         }
       fputs ("</sup>", html->file);
     }