diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2015-02-01 23:10:35 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2015-02-01 23:10:35 +0000 |
commit | d769b406898f4cb6b65c691825fb2a8f9d89aa13 (patch) | |
tree | b5fa70221be2cd8a20f1980059486fe0246abb5a /mdoc_man.c | |
parent | 551e90b6e3a351a26caa834d997cc49edfe32535 (diff) | |
download | mandoc-d769b406898f4cb6b65c691825fb2a8f9d89aa13.tar.gz mandoc-d769b406898f4cb6b65c691825fb2a8f9d89aa13.tar.zst mandoc-d769b406898f4cb6b65c691825fb2a8f9d89aa13.zip |
fix .Eo/.Ec spacing
Diffstat (limited to 'mdoc_man.c')
-rw-r--r-- | mdoc_man.c | 28 |
1 files changed, 25 insertions, 3 deletions
@@ -1,4 +1,4 @@ -/* $Id: mdoc_man.c,v 1.83 2015/01/28 17:32:07 schwarze Exp $ */ +/* $Id: mdoc_man.c,v 1.84 2015/02/01 23:10:35 schwarze Exp $ */ /* * Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org> * @@ -1134,16 +1134,38 @@ static int pre_eo(DECL_ARGS) { - outflags &= ~(MMAN_spc | MMAN_nl); + if (n->end == ENDBODY_NOT && + n->parent->head->child == NULL && + n->child != NULL && + n->child->end != ENDBODY_NOT) + print_word("\\&"); + else if (n->end != ENDBODY_NOT ? n->child != NULL : + n->parent->head->child != NULL && + (n->parent->body->child != NULL || + n->parent->tail->child != NULL)) + outflags &= ~(MMAN_spc | MMAN_nl); return(1); } static void post_eo(DECL_ARGS) { + int body, tail; + + if (n->end != ENDBODY_NOT) { + outflags |= MMAN_spc; + return; + } - if (n->end != ENDBODY_SPACE) + body = n->child != NULL || n->parent->head->child != NULL; + tail = n->parent->tail != NULL && n->parent->tail->child != NULL; + + if (body && tail) outflags &= ~MMAN_spc; + else if ( ! (body || tail)) + print_word("\\&"); + else if ( ! tail) + outflags |= MMAN_spc; } static int |