diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-01-11 14:12:01 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-01-11 14:12:01 +0000 |
commit | fa73a21290e351913eadd2b70b4471fd30829483 (patch) | |
tree | cb524df5813e538c91ca612c4110c9e4291a7eb9 | |
parent | c68f7a36a22b06ab0bb6afcd32d531d893abbc57 (diff) | |
download | mandoc-fa73a21290e351913eadd2b70b4471fd30829483.tar.gz |
Add support for "^" vertical spanners. Unlike GNU tbl, raise
error-class messages when data is being ignored by specifying it in "^"
cells (either as-is or in blocks).
Also note again that horizontal spanners aren't really supported...
-rw-r--r-- | out.c | 2 | ||||
-rw-r--r-- | tbl.7 | 12 | ||||
-rw-r--r-- | tbl_data.c | 6 | ||||
-rw-r--r-- | tbl_html.c | 14 | ||||
-rw-r--r-- | tbl_layout.c | 10 | ||||
-rw-r--r-- | tbl_term.c | 3 |
6 files changed, 40 insertions, 7 deletions
@@ -453,6 +453,8 @@ tblcalc_data(struct rofftbl *tbl, struct roffcol *col, case (TBL_CELL_NUMBER): tblcalc_number(tbl, col, tp, dp); break; + case (TBL_CELL_DOWN): + break; default: abort(); /* NOTREACHED */ @@ -209,17 +209,23 @@ Justify a number around its last decimal point. If the decimal point is not found on the number, it's assumed to trail the number. .It Cm s -Span columns from the last non-span data cell. +Horizontally span columns from the last non- +.Ns Cm s +data cell. It is an error if spanning columns follow a .Cm \- or .Cm \(ba cell, or come first. +This option is not supported by +.Xr mandoc 1 . .It Cm a Left-justify a literal string and pad with one space. .It Cm ^ -This option is not supported by -.Xr mandoc 1 . +Vertically span rows from the last non- +.Ns Cm ^ +data cell. +It is an error to invoke a vertical span on the first layout row. .It Cm \- Replace the data cell (its contents will be lost) with a single horizontal line. @@ -122,7 +122,8 @@ data(struct tbl_node *tbl, struct tbl_span *dp, dat->pos = TBL_DATA_DATA; if (TBL_CELL_HORIZ == dat->layout->pos || - TBL_CELL_DHORIZ == dat->layout->pos) + TBL_CELL_DHORIZ == dat->layout->pos || + TBL_CELL_DOWN == dat->layout->pos) if (TBL_DATA_DATA == dat->pos && '\0' != *dat->string) TBL_MSG(tbl, MANDOCERR_TBLIGNDATA, ln, sv); @@ -165,6 +166,9 @@ tbl_cdata(struct tbl_node *tbl, int ln, const char *p) } else dat->string = mandoc_strdup(p); + if (TBL_CELL_DOWN == dat->layout->pos) + TBL_MSG(tbl, MANDOCERR_TBLIGNDATA, ln, pos); + return(0); } @@ -104,10 +104,18 @@ print_tbl(struct html *h, const struct tbl_span *sp) PAIR_STYLE_INIT(&tag, h); tt = print_otag(h, TAG_TD, 1, &tag); - if (dp && dp->string) - print_text(h, dp->string); - if (dp) + if (dp) { + switch (dp->layout->pos) { + case (TBL_CELL_DOWN): + break; + default: + if (NULL == dp->string) + break; + print_text(h, dp->string); + break; + } dp = dp->next; + } print_tagq(h, tt); } diff --git a/tbl_layout.c b/tbl_layout.c index 25b77e1c..7063aaff 100644 --- a/tbl_layout.c +++ b/tbl_layout.c @@ -220,6 +220,16 @@ cell(struct tbl_node *tbl, struct tbl_row *rp, } } + /* + * If a vertical spanner is found, we may not be in the first + * row. + */ + + if (TBL_CELL_DOWN == c && rp == tbl->first_row) { + TBL_MSG(tbl, MANDOCERR_TBLLAYOUT, ln, *pos); + return(0); + } + (*pos)++; /* Extra check for the double-vertical. */ @@ -305,6 +305,9 @@ tbl_data(struct termp *tp, const struct tbl *tbl, case (TBL_CELL_NUMBER): tbl_number(tp, tbl, dp, col); break; + case (TBL_CELL_DOWN): + tbl_char(tp, ASCII_NBRSP, col->width); + break; default: abort(); /* NOTREACHED */ |