From cc27096dbcc3e80b3856592d7181047e295adeef Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Tue, 4 Dec 2018 03:28:58 +0000 Subject: 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 reported that -T html got confused in particular. --- roff_validate.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'roff_validate.c') 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 * @@ -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; -- cgit v1.2.3-56-ge451