output: Implement styling for footnotes.
authorBen Pfaff <blp@cs.stanford.edu>
Thu, 22 Nov 2018 05:25:13 +0000 (21:25 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Tue, 25 Dec 2018 20:45:21 +0000 (12:45 -0800)
src/output/render.c
src/output/tab.c
src/output/tab.h
src/output/table-provider.h
tests/output/render-test.c

index c3a59a6c429c01aa97ec7489a48cb543c7d5d0ce..f73137f0e35eafe8ab11b8981de11998f01c73cf 100644 (file)
@@ -1425,6 +1425,11 @@ add_footnote_page (struct render_pager *p, const struct table_item *item)
       {
         tab_text_format (t, 0, i, TAB_LEFT, "%s.", f[i]->marker);
         tab_text (t, 1, i, TAB_LEFT, f[i]->content);
+        if (f[i]->style)
+          {
+            tab_add_style (t, 0, i, f[i]->style);
+            tab_add_style (t, 1, i, f[i]->style);
+          }
       }
   render_pager_add_table (p, &t->table);
 
index db8488d8546329339e56c57d213b7d59b8831218..435fa609ce06d4547f885f07aad3ad5c6e336e08 100644 (file)
@@ -621,12 +621,13 @@ tab_joint_text_format (struct tab_table *table, int x1, int y1, int x2,
 
 struct footnote *
 tab_create_footnote (struct tab_table *table, size_t idx, const char *content,
-                     const char *marker)
+                     const char *marker, struct cell_style *style)
 {
   struct footnote *f = pool_alloc (table->container, sizeof *f);
   f->idx = idx;
   f->content = pool_strdup (table->container, content);
   f->marker = pool_strdup (table->container, marker);
+  f->style = style;
   return f;
 }
 
index f45e1f605589f66729ed872f6cc9bbed44256d15..40f871b12df5101cc718a07d16e2de02cbaf627f 100644 (file)
@@ -155,7 +155,8 @@ void tab_joint_text_format (struct tab_table *, int x1, int y1, int x2, int y2,
      PRINTF_FORMAT (7, 8);
 
 struct footnote *tab_create_footnote (struct tab_table *, size_t idx,
-                                      const char *content, const char *marker);
+                                      const char *content, const char *marker,
+                                      struct cell_style *);
 void tab_add_footnote (struct tab_table *, int x, int y,
                        const struct footnote *);
 
index d875462c9c237b7c00f3f8f3e88b32666da55a17..2a3a17c9daeec45e4c8461ce6bcd2255b2cc8b68 100644 (file)
@@ -27,6 +27,7 @@ struct footnote
     size_t idx;
     char *content;
     char *marker;
+    struct cell_style *style;
   };
 
 /* An item of contents within a table cell. */
index 42b8795336f6f354b0391f6b46246bb3ecbbdcd8..e5eea91d94fefd0b2f9ae921e87699bf3b5eb5bf 100644 (file)
@@ -475,7 +475,7 @@ read_table (FILE *stream)
               {
                 char marker[2] = { 'a' + n_footnotes, '\0' };
                 struct footnote *f = tab_create_footnote (
-                  tab, n_footnotes, content, marker);
+                  tab, n_footnotes, content, marker, NULL);
                 tab_add_footnote (tab, c, r, f);
                 n_footnotes++;
               }