cairo-fsm: Implement dashed lines.
[pspp] / src / output / csv.c
index 6c2f7495c45d494acab3e6165f4389ceb3f0b0b7..04939222410c9e914ceacd15cb02d3f761f3d523 100644 (file)
@@ -30,6 +30,7 @@
 #include "output/driver-provider.h"
 #include "output/options.h"
 #include "output/message-item.h"
+#include "output/page-eject-item.h"
 #include "output/table-item.h"
 #include "output/table-provider.h"
 
@@ -214,9 +215,9 @@ csv_submit (struct output_driver *driver,
         csv_output_table_item_text (csv, table_item_get_title (table_item),
                                     "Table");
 
-      for (y = 0; y < table_nr (t); y++)
+      for (y = 0; y < t->n[TABLE_VERT]; y++)
         {
-          for (x = 0; x < table_nc (t); x++)
+          for (x = 0; x < t->n[TABLE_HORZ]; x++)
             {
               struct table_cell cell;
 
@@ -227,7 +228,8 @@ csv_submit (struct output_driver *driver,
 
               if (x != cell.d[TABLE_HORZ][0] || y != cell.d[TABLE_VERT][0])
                 csv_output_field (csv, "");
-              else if (!(cell.options & TAB_MARKUP) && !cell.n_footnotes)
+              else if (!(cell.options & TAB_MARKUP) && !cell.n_footnotes
+                       && !cell.n_subscripts && !cell.superscript)
                 csv_output_field (csv, cell.text);
               else
                 {
@@ -242,6 +244,12 @@ csv_submit (struct output_driver *driver,
                   else
                     ds_put_cstr (&s, cell.text);
 
+                  if (cell.n_subscripts)
+                    for (size_t i = 0; i < cell.n_subscripts; i++)
+                      ds_put_format (&s, "%c%s",
+                                     i ? ',' : '_', cell.subscripts[i]);
+                  if (cell.superscript)
+                    ds_put_format (&s, "^%s", cell.superscript);
                   csv_format_footnotes (cell.footnotes, cell.n_footnotes, &s);
                   csv_output_field (csv, ds_cstr (&s));
                   ds_destroy (&s);
@@ -291,6 +299,11 @@ csv_submit (struct output_driver *driver,
       else
         csv_output_lines (csv, text);
     }
+  else if (is_page_eject_item (output_item))
+    {
+      csv_put_separator (csv);
+      csv_output_lines (csv, "");
+    }
   else if (is_message_item (output_item))
     {
       const struct message_item *message_item = to_message_item (output_item);