output: Add support for Pango markup of fonts and styles.
[pspp] / src / output / csv.c
index c5d418293efcaa00a340efa8900701172037cae8..17c26a062605f96523b96e9cb17ed5ca893a0f0b 100644 (file)
@@ -228,7 +228,14 @@ csv_submit (struct output_driver *driver,
                       if (i > 0)
                         ds_put_cstr (&s, "\n\n");
 
-                      ds_put_cstr (&s, c->text);
+                      if (c->options & TAB_MARKUP)
+                        {
+                          char *t = output_get_text_from_markup (c->text);
+                          ds_put_cstr (&s, t);
+                          free (t);
+                        }
+                      else
+                        ds_put_cstr (&s, c->text);
                       csv_format_footnotes (c->footnotes, c->n_footnotes, &s);
                     }
                   csv_output_field (csv, ds_cstr (&s));
@@ -268,19 +275,24 @@ csv_submit (struct output_driver *driver,
       enum text_item_type type = text_item_get_type (text_item);
       const char *text = text_item_get_text (text_item);
 
-      if (type == TEXT_ITEM_COMMAND_OPEN || type == TEXT_ITEM_COMMAND_CLOSE
-          || type == TEXT_ITEM_SYNTAX || type == TEXT_ITEM_PAGE_TITLE)
+      if (type == TEXT_ITEM_SYNTAX || type == TEXT_ITEM_PAGE_TITLE)
         return;
 
       csv_put_separator (csv);
-      csv_output_field (csv, text);
+      if (text_item->markup)
+        {
+          char *plain_text = output_get_text_from_markup (text);
+          csv_output_field (csv, plain_text);
+          free (plain_text);
+        }
+      else
+        csv_output_field (csv, text);
       putc ('\n', csv->file);
     }
   else if (is_message_item (output_item))
     {
       const struct message_item *message_item = to_message_item (output_item);
-      const struct msg *msg = message_item_get_msg (message_item);
-      char *s = msg_to_string (msg, message_item->command_name);
+      char *s = msg_to_string (message_item_get_msg (message_item));
       csv_put_separator (csv);
       csv_output_field (csv, s);
       free (s);