summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-01-24 11:56:35 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-01-24 11:56:35 +0000
commit2280bcec86252e6c17969e61e8c530213b977ed8 (patch)
tree49662f715317f45b643fac43664651abafa5d2ab
parent78c72f07f66899c67ada30fab21ffffa02adb6e1 (diff)
Improve formatting of broken blocks in -Tman,
somewhat similar to what mdoc_term.c already does for -Tascii.
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bd/Makefile6
-rw-r--r--usr.bin/mandoc/mdoc_man.c15
2 files changed, 14 insertions, 7 deletions
diff --git a/regress/usr.bin/mandoc/mdoc/Bd/Makefile b/regress/usr.bin/mandoc/mdoc/Bd/Makefile
index b687b3c7ecb..2960117d412 100644
--- a/regress/usr.bin/mandoc/mdoc/Bd/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Bd/Makefile
@@ -1,12 +1,10 @@
-# $OpenBSD: Makefile,v 1.8 2012/11/18 17:59:03 schwarze Exp $
+# $OpenBSD: Makefile,v 1.9 2014/01/24 11:56:34 schwarze Exp $
REGRESS_TARGETS = blank nested spacing empty offset-empty break broken
-# groff-1.20.1 defect:
+# groff defect:
# - a display breaking another block continues indefinitely
SKIP_GROFF = break
-SKIP_TMAN = break broken
-
.include <bsd.regress.mk>
diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c
index 031f6b15398..f4647974021 100644
--- a/usr.bin/mandoc/mdoc_man.c
+++ b/usr.bin/mandoc/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_man.c,v 1.57 2014/01/22 20:58:35 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.58 2014/01/24 11:56:34 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -594,7 +594,7 @@ print_node(DECL_ARGS)
*/
act = manacts + n->tok;
cond = NULL == act->cond || (*act->cond)(meta, n);
- if (cond && act->pre)
+ if (cond && act->pre && ENDBODY_NOT == n->end)
do_sub = (*act->pre)(meta, n);
}
@@ -610,8 +610,17 @@ print_node(DECL_ARGS)
/*
* Lastly, conditionally run the post-node handler.
*/
+ if (MDOC_ENDED & n->flags)
+ return;
+
if (cond && act->post)
(*act->post)(meta, n);
+
+ if (ENDBODY_NOT != n->end)
+ n->pending->flags |= MDOC_ENDED;
+
+ if (ENDBODY_NOSPACE == n->end)
+ outflags &= ~(MMAN_spc | MMAN_nl);
}
static int
@@ -649,7 +658,7 @@ post_enc(DECL_ARGS)
suffix = manacts[n->tok].suffix;
if (NULL == suffix)
return;
- outflags &= ~MMAN_spc;
+ outflags &= ~(MMAN_spc | MMAN_nl);
print_word(suffix);
}