diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2018-12-04 03:28:58 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2018-12-04 03:28:58 +0000 |
commit | cc27096dbcc3e80b3856592d7181047e295adeef (patch) | |
tree | 20a7333819ed8f8fbc3f1868c2c42b646e216a65 | |
parent | b8c7224b007d9673c637669ba26ff55f38effe12 (diff) | |
download | mandoc-cc27096dbcc3e80b3856592d7181047e295adeef.tar.gz mandoc-cc27096dbcc3e80b3856592d7181047e295adeef.tar.zst mandoc-cc27096dbcc3e80b3856592d7181047e295adeef.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.
-rw-r--r-- | roff_validate.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/roff_validate.c b/roff_validate.c index 3e301c05..222f2339 100644 --- a/roff_validate.c +++ b/roff_validate.c @@ -1,4 +1,4 @@ -/* $Id: roff_validate.c,v 1.11 2018/12/04 02:53:51 schwarze Exp $ */ +/* $Id: roff_validate.c,v 1.12 2018/12/04 03:28:58 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; |