it works again
[pspp] / src / output / html.c
index f8213952e1294b0bfe9a359b991c78847c6d706a..2dcdf52f0663fb18b47401b8ecbd3763928be28f 100644 (file)
@@ -481,26 +481,6 @@ put_border (const struct table *table, const struct table_cell *cell,
     }
 }
 
-static void
-html_put_footnote_markers (struct html_driver *html,
-                           struct footnote **footnotes,
-                           size_t n_footnotes)
-{
-  if (n_footnotes > 0)
-    {
-      fputs ("<sup>", html->file);
-      for (size_t i = 0; i < n_footnotes; i++)
-        {
-          const struct footnote *f = footnotes[i];
-
-          if (i > 0)
-            putc (',', html->file);
-          escape_string (html->file, f->marker, " ", "<br>");
-        }
-      fputs ("</sup>", html->file);
-    }
-}
-
 static void
 html_put_table_cell_text (struct html_driver *html,
                           const struct table_cell *cell)
@@ -526,7 +506,22 @@ html_put_table_cell_text (struct html_driver *html,
         }
       fputs ("</sub>", html->file);
     }
-  html_put_footnote_markers (html, cell->footnotes, cell->n_footnotes);
+  if (cell->n_footnotes > 0)
+    {
+      fputs ("<sup>", html->file);
+      for (size_t i = 0; i < cell->n_footnotes; i++)
+        {
+          if (i > 0)
+            putc (',', html->file);
+
+          char *marker = pivot_value_to_string (cell->footnotes[i]->marker,
+                                                SETTINGS_VALUE_SHOW_DEFAULT,
+                                                SETTINGS_VALUE_SHOW_DEFAULT);
+          escape_string (html->file, marker, " ", "<br>");
+          free (marker);
+        }
+      fputs ("</sup>", html->file);
+    }
 }
 
 static void
@@ -704,17 +699,18 @@ html_output_table_layer (struct html_driver *html, const struct pivot_table *pt,
           fputs ("</tr>\n", html->file);
         }
 
-      for (size_t y = 0; y < footnotes->n[V]; y++)
-        {
-          fputs ("<tr>\n", html->file);
+      if (footnotes)
+        for (size_t y = 0; y < footnotes->n[V]; y++)
+          {
+            fputs ("<tr>\n", html->file);
 
-          struct table_cell cell;
-          table_get_cell (footnotes, 0, y, &cell);
-          cell.d[H][1] = body->n[H];
-          html_put_table_cell (html, &cell, "td", NULL);
+            struct table_cell cell;
+            table_get_cell (footnotes, 0, y, &cell);
+            cell.d[H][1] = body->n[H];
+            html_put_table_cell (html, &cell, "td", NULL);
 
-          fputs ("</tr>\n", html->file);
-        }
+            fputs ("</tr>\n", html->file);
+          }
       fputs ("</tfoot>\n", html->file);
     }