summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/roff_validate.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2018-12-04 03:28:54 +0000
committerschwarze <schwarze@openbsd.org>2018-12-04 03:28:54 +0000
commit4a0fe8a5b81e76ceee5d3eaa55edc2cb46f51e84 (patch)
treef44607d39e32d7a84cee771b2dff938f999e0dfb /usr.bin/mandoc/roff_validate.c
parentClean up the validation of .Pp, .PP, .sp, and .br. Make sure all (diff)
downloadwireguard-openbsd-4a0fe8a5b81e76ceee5d3eaa55edc2cb46f51e84.tar.xz
wireguard-openbsd-4a0fe8a5b81e76ceee5d3eaa55edc2cb46f51e84.zip
During validation, drop .br before a text line starting with a
blank, rather than teaching each formatter individually to ignore the .br in such situations. That's simpler and also results in better diagnostics. Mark Harris <mark dot hsj at gmail dot com> reported that -T html got confused in particular.
Diffstat (limited to 'usr.bin/mandoc/roff_validate.c')
-rw-r--r--usr.bin/mandoc/roff_validate.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.bin/mandoc/roff_validate.c b/usr.bin/mandoc/roff_validate.c
index 4d9c7839db8..ee0c1c23446 100644
--- a/usr.bin/mandoc/roff_validate.c
+++ b/usr.bin/mandoc/roff_validate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: roff_validate.c,v 1.11 2018/12/04 02:53:45 schwarze Exp $ */
+/* $OpenBSD: roff_validate.c,v 1.12 2018/12/04 03:28:54 schwarze Exp $ */
/*
* Copyright (c) 2010, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -67,6 +67,14 @@ roff_valid_br(ROFF_VALID_ARGS)
mandoc_vmsg(MANDOCERR_ARG_SKIP, man->parse,
n->line, n->pos, "br %s", n->child->string);
+ if (n->next != NULL && n->next->type == ROFFT_TEXT &&
+ *n->next->string == ' ') {
+ mandoc_msg(MANDOCERR_PAR_SKIP, man->parse, n->line, n->pos,
+ "br before text line with leading blank");
+ roff_node_delete(man, n);
+ return;
+ }
+
if ((np = n->prev) == NULL)
return;