diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2015-01-28 17:32:07 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2015-01-28 17:32:07 +0000 |
commit | 67cfc20e20f4c603c852ddf5c88024ce0d8d628c (patch) | |
tree | 5e3c7114721eba342929a649511dbf5a94439d6c /tbl.c | |
parent | 7793230177d864fb80c0c572a2b896f3ecb7df10 (diff) | |
download | mandoc-67cfc20e20f4c603c852ddf5c88024ce0d8d628c.tar.gz mandoc-67cfc20e20f4c603c852ddf5c88024ce0d8d628c.tar.zst mandoc-67cfc20e20f4c603c852ddf5c88024ce0d8d628c.zip |
* Polish tbl(7) error reporting.
* Do not print out macro names in tbl(7) data blocks.
* Like with GNU tbl, let empty tables cause a blank line.
* Avoid producing empty tables in -Tman.
Diffstat (limited to 'tbl.c')
-rw-r--r-- | tbl.c | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -1,4 +1,4 @@ -/* $Id: tbl.c,v 1.35 2015/01/28 15:03:45 schwarze Exp $ */ +/* $Id: tbl.c,v 1.36 2015/01/28 17:32:07 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011, 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -143,17 +143,13 @@ tbl_free(struct tbl_node *tbl) void tbl_restart(int line, int pos, struct tbl_node *tbl) { - if (TBL_PART_CDATA == tbl->part) - mandoc_msg(MANDOCERR_TBLBLOCK, tbl->parse, - tbl->line, tbl->pos, NULL); + if (tbl->part == TBL_PART_CDATA) + mandoc_msg(MANDOCERR_TBLDATA_BLK, tbl->parse, + line, pos, "T&"); tbl->part = TBL_PART_LAYOUT; tbl->line = line; tbl->pos = pos; - - if (NULL == tbl->first_span || NULL == tbl->first_span->first) - mandoc_msg(MANDOCERR_TBLNODATA, tbl->parse, - tbl->line, tbl->pos, NULL); } const struct tbl_span * @@ -169,7 +165,7 @@ tbl_span(struct tbl_node *tbl) return(span); } -void +int tbl_end(struct tbl_node **tblp) { struct tbl_node *tbl; @@ -178,17 +174,21 @@ tbl_end(struct tbl_node **tblp) tbl = *tblp; *tblp = NULL; + if (tbl->part == TBL_PART_CDATA) + mandoc_msg(MANDOCERR_TBLDATA_BLK, tbl->parse, + tbl->line, tbl->pos, "TE"); + sp = tbl->first_span; while (sp != NULL && sp->first == NULL) sp = sp->next; - if (sp == NULL) - mandoc_msg(MANDOCERR_TBLNODATA, tbl->parse, + if (sp == NULL) { + mandoc_msg(MANDOCERR_TBLDATA_NONE, tbl->parse, tbl->line, tbl->pos, NULL); + return(0); + } - if (tbl->last_span) + if (tbl->last_span != NULL) tbl->last_span->flags |= TBL_SPAN_LAST; - if (TBL_PART_CDATA == tbl->part) - mandoc_msg(MANDOCERR_TBLBLOCK, tbl->parse, - tbl->line, tbl->pos, NULL); + return(1); } |