=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mdoc_man.c,v retrieving revision 1.81 retrieving revision 1.82 diff -u -r1.81 -r1.82 --- src/usr.bin/mandoc/mdoc_man.c 2015/01/28 17:30:37 1.81 +++ src/usr.bin/mandoc/mdoc_man.c 2015/02/01 23:10:15 1.82 @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_man.c,v 1.81 2015/01/28 17:30:37 schwarze Exp $ */ +/* $OpenBSD: mdoc_man.c,v 1.82 2015/02/01 23:10:15 schwarze Exp $ */ /* * Copyright (c) 2011-2015 Ingo Schwarze * @@ -1132,16 +1132,38 @@ 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_SPACE) + if (n->end != ENDBODY_NOT) { + outflags |= MMAN_spc; + return; + } + + 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