summaryrefslogtreecommitdiffstats
path: root/mdoc_man.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-02-01 23:10:35 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-02-01 23:10:35 +0000
commit1d29c2a24a3538a81256f8f14c5e496fb90837e6 (patch)
tree3d720723b35903baaf89864115e876b4a0db3673 /mdoc_man.c
parent871a699012dc95eebbafa24701859316ba995d6b (diff)
downloadmandoc-1d29c2a24a3538a81256f8f14c5e496fb90837e6.tar.gz
fix .Eo/.Ec spacing
Diffstat (limited to 'mdoc_man.c')
-rw-r--r--mdoc_man.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/mdoc_man.c b/mdoc_man.c
index db9405b0..131e1f3f 100644
--- a/mdoc_man.c
+++ b/mdoc_man.c
@@ -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