output: Remove superscript support.
authorBen Pfaff <blp@cs.stanford.edu>
Thu, 31 Dec 2020 03:27:10 +0000 (19:27 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Thu, 31 Dec 2020 03:27:10 +0000 (19:27 -0800)
The previous commit df5005061c03 ("pivot-output: Implement superscript.")
finished this support, but on further inspection, there's nothing in the
non-legacy .spv format that can set a superscript.  The legacy .spv format
appears to be able to do it; I'll worry about that if it gets implemented
later.

src/output/ascii.c
src/output/cairo-fsm.c
src/output/csv.c
src/output/html.c
src/output/pivot-output.c
src/output/pivot-table.c
src/output/pivot-table.h
src/output/table-provider.h
src/output/table.c
src/output/table.h

index f019fda4e112c5885b432e752b5e771432af9755..29cc73b81115dcb1f5d0216c49919dcd93640abd 100644 (file)
@@ -706,7 +706,7 @@ ascii_measure_cell_width (void *a_, const struct table_cell *cell,
   ascii_layout_cell (a, cell, bb, clip, max_width, &h);
 
   if (cell->n_footnotes || strchr (cell->text, ' ')
-      || cell->n_subscripts || cell->superscript)
+      || cell->n_subscripts)
     {
       bb[H][1] = 1;
       ascii_layout_cell (a, cell, bb, clip, min_width, &h);
@@ -907,8 +907,6 @@ add_markers (const char *text, const struct table_cell *cell)
   ds_put_cstr (&s, text);
   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);
   for (size_t i = 0; i < cell->n_footnotes; i++)
     ds_put_format (&s, "[%s]", cell->footnotes[i]->marker);
   return ds_steal_cstr (&s);
@@ -927,9 +925,9 @@ ascii_layout_cell (struct ascii_driver *a, const struct table_cell *cell,
                             ? output_get_text_from_markup (cell->text)
                             : cell->text);
 
-  /* Append footnotes, subscripts, superscript if any. */
+  /* Append footnotes, subscripts if any. */
   const char *text;
-  if (cell->n_footnotes || cell->n_subscripts || cell->superscript)
+  if (cell->n_footnotes || cell->n_subscripts)
     {
       text = add_markers (plain_text, cell);
       if (plain_text != cell->text)
index 16cf47dec43883b711da0d14cf4fd371f7a1e22a..39f1cf02e990fd33ff345975f35daac2dd88aaff 100644 (file)
@@ -725,7 +725,7 @@ xr_layout_cell_text (struct xr_fsm *xr, const struct table_cell *cell,
                                 PANGO_UNDERLINE_SINGLE));
     }
 
-  if (cell->n_footnotes || cell->n_subscripts || cell->superscript)
+  if (cell->n_footnotes || cell->n_subscripts)
     {
       /* If we haven't already put TEXT into tmp, do it now. */
       if (ds_is_empty (&tmp))
@@ -742,10 +742,6 @@ xr_layout_cell_text (struct xr_fsm *xr, const struct table_cell *cell,
           ds_put_cstr (&tmp, cell->subscripts[i]);
         }
 
-      size_t superscript_ofs = ds_length (&tmp);
-      if (cell->superscript)
-        ds_put_cstr (&tmp, cell->superscript);
-
       size_t footnote_ofs = ds_length (&tmp);
       for (size_t i = 0; i < cell->n_footnotes; i++)
         {
@@ -793,9 +789,9 @@ xr_layout_cell_text (struct xr_fsm *xr, const struct table_cell *cell,
                 subscript_ofs, PANGO_ATTR_INDEX_TO_TEXT_END);
       if (cell->n_subscripts)
         add_attr (attrs, pango_attr_rise_new (-3000), subscript_ofs,
-                  superscript_ofs - subscript_ofs);
-      if (cell->superscript || cell->n_footnotes)
-        add_attr (attrs, pango_attr_rise_new (3000), superscript_ofs,
+                  footnote_ofs - subscript_ofs);
+      if (cell->n_footnotes)
+        add_attr (attrs, pango_attr_rise_new (3000), footnote_ofs,
                   PANGO_ATTR_INDEX_TO_TEXT_END);
     }
 
index 04939222410c9e914ceacd15cb02d3f761f3d523..e5b47a06ef0b7c0e1c35517d96338062073c0975 100644 (file)
@@ -229,7 +229,7 @@ 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
-                       && !cell.n_subscripts && !cell.superscript)
+                       && !cell.n_subscripts)
                 csv_output_field (csv, cell.text);
               else
                 {
@@ -248,8 +248,6 @@ csv_submit (struct output_driver *driver,
                     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);
index df7003a4a90cf4b9f74ff5bd000f954d375cbfc4..64db78dc8ec0c88fb931e913e282c9caea1be060 100644 (file)
@@ -532,8 +532,6 @@ html_put_table_cell_text (struct html_driver *html,
         }
       fputs ("</sub>", html->file);
     }
-  if (cell->superscript)
-    escape_tag (html->file, "sup", cell->superscript, "&nbsp;", "<br>");
   html_put_footnote_markers (html, cell->footnotes, cell->n_footnotes);
 }
 
index 12e1efafdb9b5db905642cd8c0e3614c8a3fabfb..44a044b8b0ff3bbc67b321d222aa3d04065f911d 100644 (file)
@@ -135,9 +135,6 @@ fill_cell (struct table *t, int x1, int y1, int x2, int y2,
       if (value->n_subscripts)
         table_add_subscripts (t, x1, y1,
                               value->subscripts, value->n_subscripts);
-
-      if (value->superscript)
-        table_add_superscript (t, x1, y1, value->superscript);
     }
 }
 
index adebd84ffab723d04245cc2bfeab8c352a0c50e3..5c6467147300d43c0c98720c28a9b25ecaaecab8 100644 (file)
@@ -2007,7 +2007,7 @@ pivot_value_format_body (const struct pivot_value *value,
 /* Appends a text representation of VALUE to OUT.  SHOW_VALUES and
    SHOW_VARIABLES control whether variable and value labels are included.
 
-   Subscripts and superscripts and footnotes are included. */
+   Subscripts and footnotes are included. */
 void
 pivot_value_format (const struct pivot_value *value,
                     enum settings_value_show show_values,
@@ -2022,9 +2022,6 @@ pivot_value_format (const struct pivot_value *value,
         ds_put_format (out, "%c%s", i ? ',' : '_', value->subscripts[i]);
     }
 
-  if (value->superscript)
-    ds_put_format (out, "^%s", value->superscript);
-
   for (size_t i = 0; i < value->n_footnotes; i++)
     {
       ds_put_byte (out, '^');
@@ -2062,8 +2059,6 @@ pivot_value_destroy (struct pivot_value *value)
         free (value->subscripts[i]);
       free (value->subscripts);
 
-      free (value->superscript);
-
       switch (value->type)
         {
         case PIVOT_VALUE_NUMERIC:
index 6769b600baada8de089d63c82e7b1b2424f50945..be82d0685ee1b6d4d80b06e00862967d8e2726b6 100644 (file)
@@ -639,8 +639,6 @@ struct pivot_value
     char **subscripts;
     size_t n_subscripts;
 
-    char *superscript;
-
     const struct pivot_footnote **footnotes;
     size_t n_footnotes;
 
index be45912d92148994b3484404cdb8d3e626497a58..8cac97a6d9b8363e2c0c56bdd14be60397db76af 100644 (file)
@@ -57,7 +57,6 @@ struct table_cell
     char *text;                 /* A paragraph of text. */
     char **subscripts;
     size_t n_subscripts;
-    char *superscript;
     const struct footnote **footnotes;
     size_t n_footnotes;
     const struct table_area_style *style;
index ace6c3cb59df74396fca4b2e2ac5cf06cb18ca8f..5087441224a3c75bcea5f2e87ab3eb7fd9521e90 100644 (file)
@@ -638,15 +638,6 @@ table_add_subscripts (struct table *table, int x, int y,
     cell->subscripts[i] = pool_strdup (table->container, subscripts[i]);
 }
 
-/* Sets the superscript for column X, row Y in TABLE. */
-void
-table_add_superscript (struct table *table, int x, int y,
-                       const char *superscript)
-{
-  get_joined_cell (table, x, y)->superscript
-    = pool_strdup (table->container, superscript);
-}
-
 /* Create a footnote in TABLE with MARKER (e.g. "a") as its marker and CONTENT
    as its content.  The footnote will be styled as STYLE, which is mandatory.
    IDX must uniquely identify the footnote within TABLE.
index edd617e8e1c673d15f2d8884f5a5a9bd246dd979..07c88874c86a47eb925089c6b9606f3859f161f4 100644 (file)
@@ -266,8 +266,6 @@ void table_joint_text (struct table *, int x1, int y1, int x2, int y2,
 
 void table_add_subscripts (struct table *, int x, int y,
                            char **subscripts, size_t n_subscripts);
-void table_add_superscript (struct table *, int x, int y,
-                            const char *superscript);
 
 /* Footnotes.