From 08d1df327e3568d9df322eda03446e633bd304f1 Mon Sep 17 00:00:00 2001 From: schwarze Date: Sat, 18 Aug 2018 14:02:52 +0000 Subject: [PATCH] Two consecutive .SY blocks only get a blank line in between if the first one is explicitly closed with .YS. --- usr.bin/mandoc/man_macro.c | 11 +++++++++-- usr.bin/mandoc/man_term.c | 5 +++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/usr.bin/mandoc/man_macro.c b/usr.bin/mandoc/man_macro.c index 7e760adb45f..6b17f1fcbce 100644 --- a/usr.bin/mandoc/man_macro.c +++ b/usr.bin/mandoc/man_macro.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_macro.c,v 1.90 2018/08/18 02:03:41 schwarze Exp $ */ +/* $OpenBSD: man_macro.c,v 1.91 2018/08/18 14:02:52 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2012-2015, 2017, 2018 Ingo Schwarze @@ -69,7 +69,7 @@ static const struct man_macro man_macros[MAN_MAX - MAN_TH] = { { in_line_eoln, MAN_NSCOPED }, /* PD */ { in_line_eoln, 0 }, /* AT */ { in_line_eoln, MAN_NSCOPED }, /* in */ - { blk_exp, MAN_BSCOPE }, /* SY */ + { blk_imp, MAN_BSCOPE }, /* SY */ { blk_close, MAN_BSCOPE }, /* YS */ { in_line_eoln, 0 }, /* OP */ { in_line_eoln, MAN_BSCOPE }, /* EX */ @@ -268,6 +268,13 @@ blk_close(MACRO_PROT_ARGS) *pos = strlen(buf); blk_imp(man, ctok, cline, cpos, pos, buf); } + + /* Synopsis blocks need an explicit end marker for spacing. */ + + if (tok == MAN_YS && man->last == nn) { + roff_elem_alloc(man, line, ppos, tok); + man_unscope(man, man->last); + } } void diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c index 5cc04456b70..b7b806e393a 100644 --- a/usr.bin/mandoc/man_term.c +++ b/usr.bin/mandoc/man_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_term.c,v 1.169 2018/08/18 13:04:48 schwarze Exp $ */ +/* $OpenBSD: man_term.c,v 1.170 2018/08/18 14:02:52 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze @@ -859,7 +859,8 @@ pre_SY(DECL_ARGS) switch (n->type) { case ROFFT_BLOCK: - print_bvspace(p, n, mt->pardist); + if (n->prev == NULL || n->prev->tok != MAN_SY) + print_bvspace(p, n, mt->pardist); return 1; case ROFFT_HEAD: case ROFFT_BODY: -- 2.20.1