diff options
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Sh/Makefile | 8 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Sh/empty.in | 10 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Sh/empty.out_ascii | 11 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Sh/empty.out_lint | 1 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_macro.c | 6 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_term.c | 17 |
6 files changed, 40 insertions, 13 deletions
diff --git a/regress/usr.bin/mandoc/mdoc/Sh/Makefile b/regress/usr.bin/mandoc/mdoc/Sh/Makefile index 72e987e4926..a740b8fa492 100644 --- a/regress/usr.bin/mandoc/mdoc/Sh/Makefile +++ b/regress/usr.bin/mandoc/mdoc/Sh/Makefile @@ -1,9 +1,9 @@ -# $OpenBSD: Makefile,v 1.4 2014/08/14 02:00:53 schwarze Exp $ +# $OpenBSD: Makefile,v 1.5 2014/11/25 03:04:32 schwarze Exp $ -REGRESS_TARGETS = before subbefore first emptyNAME badNAME order -LINT_TARGETS = before subbefore first emptyNAME badNAME order +REGRESS_TARGETS = before subbefore first emptyNAME badNAME order empty +LINT_TARGETS = before subbefore first emptyNAME badNAME order empty -SKIP_GROFF = subbefore first +SKIP_GROFF = subbefore first empty SKIP_ASCII = first .include <bsd.regress.mk> diff --git a/regress/usr.bin/mandoc/mdoc/Sh/empty.in b/regress/usr.bin/mandoc/mdoc/Sh/empty.in new file mode 100644 index 00000000000..c830ac62fd2 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Sh/empty.in @@ -0,0 +1,10 @@ +.Dd November 21, 2014 +.Dt SH-EMPTY 1 +.Os OpenBSD +.Sh NAME +.Nm Sh-empty +.Nd empty sections +.Sh SYNOPSIS +.Sh DESCRIPTION Xo +.Sh BUGS +Quite some. diff --git a/regress/usr.bin/mandoc/mdoc/Sh/empty.out_ascii b/regress/usr.bin/mandoc/mdoc/Sh/empty.out_ascii new file mode 100644 index 00000000000..d34892ff314 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Sh/empty.out_ascii @@ -0,0 +1,11 @@ +SH-EMPTY(1) General Commands Manual SH-EMPTY(1) + +NNAAMMEE + SShh--eemmppttyy - empty sections + +SSYYNNOOPPSSIISS +DDEESSCCRRIIPPTTIIOONN +BBUUGGSS + Quite some. + +OpenBSD November 21, 2014 OpenBSD diff --git a/regress/usr.bin/mandoc/mdoc/Sh/empty.out_lint b/regress/usr.bin/mandoc/mdoc/Sh/empty.out_lint new file mode 100644 index 00000000000..28d05c97c37 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Sh/empty.out_lint @@ -0,0 +1 @@ +mandoc: empty.in:9:2: ERROR: inserting missing end of block: Sh breaks Xo diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c index 6c584c54def..f26a6a384e0 100644 --- a/usr.bin/mandoc/mdoc_macro.c +++ b/usr.bin/mandoc/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_macro.c,v 1.101 2014/11/20 00:30:34 schwarze Exp $ */ +/* $OpenBSD: mdoc_macro.c,v 1.102 2014/11/25 03:04:32 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -435,9 +435,11 @@ rew_dohalt(enum mdoct tok, enum mdoc_type type, * Default block rewinding rules. * In particular, always skip block end markers, * and let all blocks rewind Nm children. + * Do not warn again when closing a block, + * since closing the body already warned. */ if (ENDBODY_NOT != p->end || MDOC_Nm == p->tok || - (MDOC_BLOCK == p->type && + MDOC_BLOCK == type || (MDOC_BLOCK == p->type && ! (MDOC_EXPLICIT & mdoc_macros[tok].flags))) return(REWIND_MORE); diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index c91170f3359..bfce12379e8 100644 --- a/usr.bin/mandoc/mdoc_term.c +++ b/usr.bin/mandoc/mdoc_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_term.c,v 1.191 2014/11/21 01:52:44 schwarze Exp $ */ +/* $OpenBSD: mdoc_term.c,v 1.192 2014/11/25 03:04:32 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -1372,14 +1372,17 @@ static int termp_sh_pre(DECL_ARGS) { - /* No vspace between consecutive `Sh' calls. */ - switch (n->type) { case MDOC_BLOCK: - if (n->prev && MDOC_Sh == n->prev->tok) - if (NULL == n->prev->body->child) - break; - term_vspace(p); + /* + * Vertical space before sections, except + * when the previous section was empty. + */ + if (n->prev == NULL || + MDOC_Sh != n->prev->tok || + (n->prev->body != NULL && + n->prev->body->child != NULL)) + term_vspace(p); break; case MDOC_HEAD: term_fontpush(p, TERMFONT_BOLD); |