=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mdoc_term.c,v retrieving revision 1.92 retrieving revision 1.93 diff -u -r1.92 -r1.93 --- src/usr.bin/mandoc/mdoc_term.c 2010/06/27 21:54:42 1.92 +++ src/usr.bin/mandoc/mdoc_term.c 2010/06/29 17:10:30 1.93 @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.92 2010/06/27 21:54:42 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.93 2010/06/29 17:10:30 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -321,20 +321,37 @@ memset(&npair, 0, sizeof(struct termpair)); npair.ppair = pair; - if (MDOC_TEXT != n->type) { - if (termacts[n->tok].pre) - chld = (*termacts[n->tok].pre)(p, &npair, m, n); - } else + if (MDOC_TEXT == n->type) term_word(p, n->string); + else if (termacts[n->tok].pre && !n->end) + chld = (*termacts[n->tok].pre)(p, &npair, m, n); if (chld && n->child) print_mdoc_nodelist(p, &npair, m, n->child); term_fontpopq(p, font); - if (MDOC_TEXT != n->type) - if (termacts[n->tok].post) - (*termacts[n->tok].post)(p, &npair, m, n); + if (MDOC_TEXT != n->type && + termacts[n->tok].post && + ! (MDOC_ENDED & n->flags)) { + (*termacts[n->tok].post)(p, &npair, m, n); + + /* + * Explicit end tokens not only call the post + * handler, but also tell the respective block + * that it must not call the post handler again. + */ + if (n->end) + n->pending->flags |= MDOC_ENDED; + + /* + * End of line terminating an implicit block + * while an explicit block is still open. + * Continue the explicit block without spacing. + */ + if (ENDBODY_NOSPACE == n->end) + p->flags |= TERMP_NOSPACE; + } if (MDOC_EOS & n->flags) p->flags |= TERMP_SENTENCE;