aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--mandoc.h7
-rw-r--r--tbl.c5
-rw-r--r--tbl_data.c8
-rw-r--r--tbl_layout.c4
4 files changed, 19 insertions, 5 deletions
diff --git a/mandoc.h b/mandoc.h
index 789e9b60..4b857db5 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc.h,v 1.43 2011/01/02 10:10:57 kristaps Exp $ */
+/* $Id: mandoc.h,v 1.44 2011/01/02 12:04:23 kristaps Exp $ */
/*
* Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -250,9 +250,14 @@ enum tbl_spant {
* A row of data in a table.
*/
struct tbl_span {
+ struct tbl *tbl;
+ struct tbl_head *head;
struct tbl_row *layout; /* layout row: CAN BE NULL */
struct tbl_dat *first;
struct tbl_dat *last;
+ int flags;
+#define TBL_SPAN_FIRST (1 << 0)
+#define TBL_SPAN_LAST (1 << 1)
enum tbl_spant pos;
struct tbl_span *next;
};
diff --git a/tbl.c b/tbl.c
index d881e0a8..35ca9e09 100644
--- a/tbl.c
+++ b/tbl.c
@@ -1,4 +1,4 @@
-/* $Id: tbl.c,v 1.17 2011/01/02 10:10:57 kristaps Exp $ */
+/* $Id: tbl.c,v 1.18 2011/01/02 12:04:23 kristaps Exp $ */
/*
* Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -153,6 +153,9 @@ tbl_end(struct tbl_node *tbl)
TBL_MSG(tbl, MANDOCERR_TBLNODATA, tbl->line, tbl->pos);
else
tbl_calc(tbl);
+
+ if (tbl->last_span)
+ tbl->last_span->flags |= TBL_SPAN_LAST;
}
static void
diff --git a/tbl_data.c b/tbl_data.c
index 560c7bf8..65659e24 100644
--- a/tbl_data.c
+++ b/tbl_data.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_data.c,v 1.8 2011/01/02 10:10:57 kristaps Exp $ */
+/* $Id: tbl_data.c,v 1.9 2011/01/02 12:04:23 kristaps Exp $ */
/*
* Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -114,13 +114,17 @@ tbl_data(struct tbl_node *tbl, int ln, const char *p)
rp = tbl->first_row;
dp = mandoc_calloc(1, sizeof(struct tbl_span));
+ dp->tbl = &tbl->opts;
dp->layout = rp;
+ dp->head = tbl->first_head;
if (tbl->last_span) {
tbl->last_span->next = dp;
tbl->last_span = dp;
- } else
+ } else {
tbl->last_span = tbl->first_span = dp;
+ dp->flags |= TBL_SPAN_FIRST;
+ }
if ( ! strcmp(p, "_")) {
dp->pos = TBL_SPAN_HORIZ;
diff --git a/tbl_layout.c b/tbl_layout.c
index 9829c9eb..d0a9c617 100644
--- a/tbl_layout.c
+++ b/tbl_layout.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_layout.c,v 1.6 2011/01/02 10:10:57 kristaps Exp $ */
+/* $Id: tbl_layout.c,v 1.7 2011/01/02 12:04:23 kristaps Exp $ */
/*
* Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -322,6 +322,8 @@ cell_alloc(struct tbl_node *tbl, struct tbl_row *rp, enum tbl_cellt pos)
hp->prev = h->prev;
if (h->prev)
h->prev->next = hp;
+ if (h == tbl->first_head)
+ tbl->first_head = hp;
h->prev = hp;
hp->next = h;
head_adjust(p, hp);