diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2018-11-25 21:17:34 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2018-11-25 21:17:34 +0000 |
commit | eab7e55d6c1099a40048c815bfa482b6850f5fb9 (patch) | |
tree | 32365f4643b8a0faab941995705143a1638a7fc1 /tbl_data.c | |
parent | 059731525cc9a54258e9e3b825e28777a212ff15 (diff) | |
download | mandoc-eab7e55d6c1099a40048c815bfa482b6850f5fb9.tar.gz |
Let cells containing nothing but \^ extend the cell above.
Missing feature reported by Pali dot Rohar at gmail dot com.
Diffstat (limited to 'tbl_data.c')
-rw-r--r-- | tbl_data.c | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -45,6 +45,15 @@ getdata(struct tbl_node *tbl, struct tbl_span *dp, struct tbl_span *pdp; int sv; + /* + * Determine the length of the string in the cell + * and advance the parse point to the end of the cell. + */ + + sv = *pos; + while (p[*pos] != '\0' && p[*pos] != tbl->opts.tab) + (*pos)++; + /* Advance to the next layout cell, skipping spanners. */ cp = dp->last == NULL ? dp->layout->first : dp->last->layout->next; @@ -67,8 +76,8 @@ getdata(struct tbl_node *tbl, struct tbl_span *dp, dp->layout->last = cp; } else { mandoc_msg(MANDOCERR_TBLDATA_EXTRA, tbl->parse, - ln, *pos, p + *pos); - while (p[*pos]) + ln, sv, p + sv); + while (p[*pos] != '\0') (*pos)++; return; } @@ -91,7 +100,8 @@ getdata(struct tbl_node *tbl, struct tbl_span *dp, * can be reused for more than one data row. */ - if (cp->pos == TBL_CELL_DOWN) { + if (cp->pos == TBL_CELL_DOWN || + (*pos - sv == 2 && p[sv] == '\\' && p[sv + 1] == '^')) { pdp = dp; while ((pdp = pdp->prev) != NULL) { pdat = pdp->first; @@ -100,7 +110,8 @@ getdata(struct tbl_node *tbl, struct tbl_span *dp, pdat = pdat->next; if (pdat == NULL) break; - if (pdat->layout->pos != TBL_CELL_DOWN) { + if (pdat->layout->pos != TBL_CELL_DOWN && + strcmp(pdat->string, "\\^") != 0) { pdat->vspans++; break; } @@ -126,10 +137,6 @@ getdata(struct tbl_node *tbl, struct tbl_span *dp, dp->last->next = dat; dp->last = dat; - sv = *pos; - while (p[*pos] && p[*pos] != tbl->opts.tab) - (*pos)++; - /* * Check for a continued-data scope opening. This consists of a * trailing `T{' at the end of the line. Subsequent lines, @@ -143,7 +150,7 @@ getdata(struct tbl_node *tbl, struct tbl_span *dp, dat->string = mandoc_strndup(p + sv, *pos - sv); - if (p[*pos]) + if (p[*pos] != '\0') (*pos)++; if ( ! strcmp(dat->string, "_")) |