From 910342c02ed6728e8edd08d68a1f3d32ded25b7c Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 30 Mar 2014 23:34:32 +0000 Subject: Improve formatting of broken blocks in -Tman, somewhat similar to what mdoc_term.c already does for -Tascii. OpenBSD rev. 1.58. --- mdoc_man.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'mdoc_man.c') diff --git a/mdoc_man.c b/mdoc_man.c index a953e755..3830e558 100644 --- a/mdoc_man.c +++ b/mdoc_man.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_man.c,v 1.60 2014/03/30 19:47:48 schwarze Exp $ */ +/* $Id: mdoc_man.c,v 1.61 2014/03/30 23:34:32 schwarze Exp $ */ /* * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze * @@ -601,7 +601,7 @@ print_node(DECL_ARGS) */ act = manacts + n->tok; cond = NULL == act->cond || (*act->cond)(meta, n); - if (cond && act->pre) + if (cond && act->pre && ENDBODY_NOT == n->end) do_sub = (*act->pre)(meta, n); } @@ -617,8 +617,17 @@ print_node(DECL_ARGS) /* * Lastly, conditionally run the post-node handler. */ + if (MDOC_ENDED & n->flags) + return; + if (cond && act->post) (*act->post)(meta, n); + + if (ENDBODY_NOT != n->end) + n->pending->flags |= MDOC_ENDED; + + if (ENDBODY_NOSPACE == n->end) + outflags &= ~(MMAN_spc | MMAN_nl); } static int @@ -656,7 +665,7 @@ post_enc(DECL_ARGS) suffix = manacts[n->tok].suffix; if (NULL == suffix) return; - outflags &= ~MMAN_spc; + outflags &= ~(MMAN_spc | MMAN_nl); print_word(suffix); } -- cgit v1.2.3