summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bl/Makefile17
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bl/emptyhead.in43
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bl/emptyhead.out_ascii38
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bl/emptyhead.out_lint4
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bl/emptytag.in17
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bl/emptytag.out_ascii16
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bl/emptytag.out_lint1
-rw-r--r--usr.bin/mandoc/mandoc.h4
-rw-r--r--usr.bin/mandoc/mdoc_term.c4
-rw-r--r--usr.bin/mandoc/mdoc_validate.c48
-rw-r--r--usr.bin/mandoc/read.c4
11 files changed, 160 insertions, 36 deletions
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/Makefile b/regress/usr.bin/mandoc/mdoc/Bl/Makefile
index 68971c97342..16a1e144965 100644
--- a/regress/usr.bin/mandoc/mdoc/Bl/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Bl/Makefile
@@ -1,18 +1,21 @@
-# $OpenBSD: Makefile,v 1.19 2014/07/02 13:10:15 schwarze Exp $
+# $OpenBSD: Makefile,v 1.20 2014/07/03 23:23:45 schwarze Exp $
REGRESS_TARGETS = item inset diag ohang bullet dash enum hang tag
REGRESS_TARGETS += column extend nested
-REGRESS_TARGETS += multitype multitag empty noIt bareTa unclosed break broken
+REGRESS_TARGETS += multitype multitag
+REGRESS_TARGETS += empty noIt emptyhead emptytag
+REGRESS_TARGETS += bareTa unclosed break broken
-LINT_TARGETS = noIt break broken
+LINT_TARGETS = noIt emptyhead emptytag break broken
-# groff-1.20.1 defects:
+# groff-1.22.2 defects:
# - empty lists ruin indentation and sometimes cause empty lines
# - breaking lists continue indefinitely
# - breaking a list aborts processing
+# - empty -tag item heads lose the blank line and the indentation
-SKIP_GROFF ?= empty break broken
+SKIP_GROFF ?= empty break broken emptytag
SKIP_TMAN ?= column multitype multitag bareTa break broken
@@ -22,4 +25,8 @@ SKIP_TMAN ?= column multitype multitag bareTa break broken
SKIP_TMAN += tag
+# Empty heads are still mishandled by -Tman.
+
+SKIP_TMAN += emptyhead emptytag
+
.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/emptyhead.in b/regress/usr.bin/mandoc/mdoc/Bl/emptyhead.in
new file mode 100644
index 00000000000..7219f969852
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Bl/emptyhead.in
@@ -0,0 +1,43 @@
+.Dd July 3, 2014
+.Dt BL-EMPTYHEAD 1
+.Os OpenBSD
+.Sh NAME
+.Nm Bl-emptyhead
+.Nd lists with empty item heads
+.Sh DESCRIPTION
+hang list:
+.Bl -hang -width 6n
+.It tag
+text
+.It
+no tag before this text
+.It tag
+text
+.El
+ohang list:
+.Bl -ohang
+.It tag
+text
+.It
+no tag before this text
+.It tag
+text
+.El
+inset list:
+.Bl -inset
+.It tag
+text
+.It
+no tag before this text
+.It tag
+text
+.El
+diag list:
+.Bl -diag
+.It tag
+text
+.It
+no tag before this text
+.It tag
+text
+.El
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/emptyhead.out_ascii b/regress/usr.bin/mandoc/mdoc/Bl/emptyhead.out_ascii
new file mode 100644
index 00000000000..53117f4f0d1
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Bl/emptyhead.out_ascii
@@ -0,0 +1,38 @@
+BL-EMPTYHEAD(1) OpenBSD Reference Manual BL-EMPTYHEAD(1)
+
+NNAAMMEE
+ BBll--eemmppttyyhheeaadd - lists with empty item heads
+
+DDEESSCCRRIIPPTTIIOONN
+ hang list:
+
+ tag text
+
+ no tag before this text
+
+ tag text
+ ohang list:
+
+ tag
+ text
+
+ no tag before this text
+
+ tag
+ text
+ inset list:
+
+ tag text
+
+ no tag before this text
+
+ tag text
+ diag list:
+
+ ttaagg text
+
+ no tag before this text
+
+ ttaagg text
+
+OpenBSD July 3, 2014 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/emptyhead.out_lint b/regress/usr.bin/mandoc/mdoc/Bl/emptyhead.out_lint
new file mode 100644
index 00000000000..7ba1b4770e0
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Bl/emptyhead.out_lint
@@ -0,0 +1,4 @@
+mandoc: emptyhead.in:12:2: WARNING: missing head in list item: hang
+mandoc: emptyhead.in:21:2: WARNING: missing head in list item: ohang
+mandoc: emptyhead.in:30:2: WARNING: missing head in list item: inset
+mandoc: emptyhead.in:39:2: WARNING: missing head in list item: diag
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/emptytag.in b/regress/usr.bin/mandoc/mdoc/Bl/emptytag.in
new file mode 100644
index 00000000000..f155b5c0a0d
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Bl/emptytag.in
@@ -0,0 +1,17 @@
+.Dd July 3, 2014
+.Dt BL-EMPTYTAG 1
+.Os OpenBSD
+.Sh NAME
+.Nm Bl-emptytag
+.Nd tag lists with empty item heads
+.Sh DESCRIPTION
+initial text
+.Bl -tag -width 6n
+.It tag
+text
+.It
+no tag before this text
+.It tag
+text
+.El
+final text
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/emptytag.out_ascii b/regress/usr.bin/mandoc/mdoc/Bl/emptytag.out_ascii
new file mode 100644
index 00000000000..f83f0539995
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Bl/emptytag.out_ascii
@@ -0,0 +1,16 @@
+BL-EMPTYTAG(1) OpenBSD Reference Manual BL-EMPTYTAG(1)
+
+NNAAMMEE
+ BBll--eemmppttyyttaagg - tag lists with empty item heads
+
+DDEESSCCRRIIPPTTIIOONN
+ initial text
+
+ tag text
+
+ no tag before this text
+
+ tag text
+ final text
+
+OpenBSD July 3, 2014 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/emptytag.out_lint b/regress/usr.bin/mandoc/mdoc/Bl/emptytag.out_lint
new file mode 100644
index 00000000000..56ff9da3cd5
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Bl/emptytag.out_lint
@@ -0,0 +1 @@
+mandoc: emptytag.in:12:2: WARNING: missing head in list item: tag
diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h
index 4c44ee81484..c1e7a5413cc 100644
--- a/usr.bin/mandoc/mandoc.h
+++ b/usr.bin/mandoc/mandoc.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc.h,v 1.75 2014/07/03 21:23:08 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.76 2014/07/03 23:23:45 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -91,6 +91,7 @@ enum mandocerr {
MANDOCERR_DISPTYPE, /* missing display type */
MANDOCERR_LISTFIRST, /* list type must come first */
MANDOCERR_NOWIDTHARG, /* tag lists require a width argument */
+ MANDOCERR_IT_NOHEAD, /* missing head in list item: type */
MANDOCERR_FONTTYPE, /* missing font type */
/* related to bad macro arguments */
@@ -146,7 +147,6 @@ enum mandocerr {
MANDOCERR_SCOPEEXIT, /* scope open on exit */
MANDOCERR_UNAME, /* uname(3) system call failed */
/* FIXME: merge following with MANDOCERR_ARGCOUNT */
- MANDOCERR_NOARGS, /* macro requires line argument(s) */
MANDOCERR_NOBODY, /* macro requires body argument(s) */
MANDOCERR_NOARGV, /* macro requires argument(s) */
MANDOCERR_NUMERIC, /* request requires a numeric argument */
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c
index a240be9f8f7..ec0d3ec08fc 100644
--- a/usr.bin/mandoc/mdoc_term.c
+++ b/usr.bin/mandoc/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.171 2014/07/02 19:54:39 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.172 2014/07/03 23:23:45 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -743,7 +743,7 @@ termp_it_pre(DECL_ARGS)
term_word(p, "\\ \\ ");
break;
case LIST_inset:
- if (MDOC_BODY == n->type)
+ if (MDOC_BODY == n->type && n->parent->head->nchild)
term_word(p, "\\ ");
break;
default:
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index 448d756c97d..1011c147470 100644
--- a/usr.bin/mandoc/mdoc_validate.c
+++ b/usr.bin/mandoc/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.141 2014/07/02 20:18:42 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.142 2014/07/03 23:23:45 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -1266,27 +1266,24 @@ post_it(POST_ARGS)
{
int i, cols;
enum mdoc_list lt;
- struct mdoc_node *n, *c;
+ struct mdoc_node *nbl, *nit, *nch;
enum mandocerr er;
- if (MDOC_BLOCK != mdoc->last->type)
+ nit = mdoc->last;
+ if (MDOC_BLOCK != nit->type)
return(1);
- n = mdoc->last->parent->parent;
- lt = n->norm->Bl.type;
+ nbl = nit->parent->parent;
+ lt = nbl->norm->Bl.type;
if (LIST__NONE == lt) {
- mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_LISTTYPE);
+ mdoc_nmsg(mdoc, nit, MANDOCERR_LISTTYPE);
return(1);
}
switch (lt) {
case LIST_tag:
- if (mdoc->last->head->child)
- break;
- /* FIXME: give this a dummy value. */
- mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOARGS);
- break;
+ /* FALLTHROUGH */
case LIST_hang:
/* FALLTHROUGH */
case LIST_ohang:
@@ -1294,8 +1291,10 @@ post_it(POST_ARGS)
case LIST_inset:
/* FALLTHROUGH */
case LIST_diag:
- if (NULL == mdoc->last->head->child)
- mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOARGS);
+ if (NULL == nit->head->child)
+ mandoc_msg(MANDOCERR_IT_NOHEAD,
+ mdoc->parse, nit->line, nit->pos,
+ mdoc_argnames[nbl->args->argv[0].arg]);
break;
case LIST_bullet:
/* FALLTHROUGH */
@@ -1304,23 +1303,23 @@ post_it(POST_ARGS)
case LIST_enum:
/* FALLTHROUGH */
case LIST_hyphen:
- if (NULL == mdoc->last->body->child)
- mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOBODY);
+ if (NULL == nit->body->child)
+ mdoc_nmsg(mdoc, nit, MANDOCERR_NOBODY);
/* FALLTHROUGH */
case LIST_item:
- if (mdoc->last->head->child)
- mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_ARGSLOST);
+ if (NULL != nit->head->child)
+ mdoc_nmsg(mdoc, nit, MANDOCERR_ARGSLOST);
break;
case LIST_column:
- cols = (int)n->norm->Bl.ncols;
+ cols = (int)nbl->norm->Bl.ncols;
- assert(NULL == mdoc->last->head->child);
+ assert(NULL == nit->head->child);
- if (NULL == mdoc->last->body->child)
- mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOBODY);
+ if (NULL == nit->body->child)
+ mdoc_nmsg(mdoc, nit, MANDOCERR_NOBODY);
- for (i = 0, c = mdoc->last->child; c; c = c->next)
- if (MDOC_BODY == c->type)
+ for (i = 0, nch = nit->child; nch; nch = nch->next)
+ if (MDOC_BODY == nch->type)
i++;
if (i < cols)
@@ -1330,8 +1329,7 @@ post_it(POST_ARGS)
else
er = MANDOCERR_SYNTARGCOUNT;
- mandoc_vmsg(er, mdoc->parse,
- mdoc->last->line, mdoc->last->pos,
+ mandoc_vmsg(er, mdoc->parse, nit->line, nit->pos,
"columns == %d (have %d)", cols, i);
return(MANDOCERR_ARGCOUNT == er);
default:
diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c
index c5d4781aec2..9381ae0407f 100644
--- a/usr.bin/mandoc/read.c
+++ b/usr.bin/mandoc/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.36 2014/07/03 21:23:08 schwarze Exp $ */
+/* $Id: read.c,v 1.37 2014/07/03 23:23:45 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -127,6 +127,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"missing display type",
"list type must come first",
"tag lists require a width argument",
+ "missing head in list item",
"missing font type",
/* related to bad macro arguments */
@@ -181,7 +182,6 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"missing end of block",
"scope open on exit",
"uname(3) system call failed",
- "macro requires line argument(s)",
"macro requires body argument(s)",
"macro requires argument(s)",
"request requires a numeric argument",