summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/man.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2015-09-04 21:24:26 +0000
committerschwarze <schwarze@openbsd.org>2015-09-04 21:24:26 +0000
commit9d496861cac97b38fed4c69efab4f32e0c3d0ba1 (patch)
tree85246a9bd13eb9374b0cae7a633c22cd1c2c9e83 /usr.bin/mandoc/man.c
parentshuffle -b into place; while there, do some general tidy up (diff)
downloadwireguard-openbsd-9d496861cac97b38fed4c69efab4f32e0c3d0ba1.tar.xz
wireguard-openbsd-9d496861cac97b38fed4c69efab4f32e0c3d0ba1.zip
Fill mode changes don't break next-line scope in all cases,
in particular not for tagged paragraphs. Issue found by Christian Neukirchen <chneukirchen at gmail dot com> in the exiv2(1) manual page.
Diffstat (limited to 'usr.bin/mandoc/man.c')
-rw-r--r--usr.bin/mandoc/man.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c
index 90916a44002..828bbfafd7e 100644
--- a/usr.bin/mandoc/man.c
+++ b/usr.bin/mandoc/man.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man.c,v 1.111 2015/04/23 16:17:04 schwarze Exp $ */
+/* $OpenBSD: man.c,v 1.112 2015/09/04 21:24:26 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -281,6 +281,20 @@ man_breakscope(struct roff_man *man, int tok)
}
/*
+ * Weird special case:
+ * Switching fill mode closes section headers.
+ */
+
+ if (man->flags & MAN_BLINE &&
+ (tok == MAN_nf || tok == MAN_fi) &&
+ (man->last->tok == MAN_SH || man->last->tok == MAN_SS)) {
+ n = man->last;
+ man_unscope(man, n);
+ roff_body_alloc(man, n->line, n->pos, n->tok);
+ man->flags &= ~MAN_BLINE;
+ }
+
+ /*
* A block header next line scope is open,
* and the new macro is not allowed inside block headers.
* Delete the block that is being broken.