=================================================================== RCS file: /cvs/mandoc/mdoc_man.c,v retrieving revision 1.101 retrieving revision 1.107 diff -u -p -r1.101 -r1.107 --- mandoc/mdoc_man.c 2017/01/11 17:39:53 1.101 +++ mandoc/mdoc_man.c 2017/04/17 12:53:29 1.107 @@ -1,4 +1,4 @@ -/* $Id: mdoc_man.c,v 1.101 2017/01/11 17:39:53 schwarze Exp $ */ +/* $Id: mdoc_man.c,v 1.107 2017/04/17 12:53:29 schwarze Exp $ */ /* * Copyright (c) 2011-2017 Ingo Schwarze * @@ -639,9 +639,6 @@ print_node(DECL_ARGS) if (ENDBODY_NOT != n->end) n->body->flags |= NODE_ENDED; - - if (ENDBODY_NOSPACE == n->end) - outflags &= ~(MMAN_spc | MMAN_nl); } static int @@ -718,10 +715,8 @@ static int pre__t(DECL_ARGS) { - if (n->parent && MDOC_Rs == n->parent->tok && - n->parent->norm->Rs.quote_T) { - print_word(""); - putchar('\"'); + if (n->parent->tok == MDOC_Rs && n->parent->norm->Rs.quote_T) { + print_word("\\(lq"); outflags &= ~MMAN_spc; } else font_push('I'); @@ -732,11 +727,9 @@ static void post__t(DECL_ARGS) { - if (n->parent && MDOC_Rs == n->parent->tok && - n->parent->norm->Rs.quote_T) { + if (n->parent->tok == MDOC_Rs && n->parent->norm->Rs.quote_T) { outflags &= ~MMAN_spc; - print_word(""); - putchar('\"'); + print_word("\\(rq"); } else font_pop(); post_percent(meta, n); @@ -1472,22 +1465,30 @@ pre_lk(DECL_ARGS) { const struct roff_node *link, *descr; - if (NULL == (link = n->child)) + if ((link = n->child) == NULL) return 0; - if (NULL != (descr = link->next)) { + /* Link text. */ + if ((descr = link->next) != NULL && !(descr->flags & NODE_DELIMC)) { font_push('I'); - while (NULL != descr) { + while (descr != NULL && !(descr->flags & NODE_DELIMC)) { print_word(descr->string); descr = descr->next; } - print_word(":"); font_pop(); + print_word(":"); } + /* Link target. */ font_push('B'); print_word(link->string); font_pop(); + + /* Trailing punctuation. */ + while (descr != NULL) { + print_word(descr->string); + descr = descr->next; + } return 0; } @@ -1518,7 +1519,7 @@ pre_nm(DECL_ARGS) } if (n->type != ROFFT_ELEM && n->type != ROFFT_HEAD) return 1; - name = n->child ? n->child->string : meta->name; + name = n->child == NULL ? NULL : n->child->string; if (NULL == name) return 0; if (n->type == ROFFT_HEAD) { @@ -1529,8 +1530,6 @@ pre_nm(DECL_ARGS) outflags |= MMAN_nl; } font_push('B'); - if (NULL == n->child) - print_word(meta->name); return 1; } @@ -1544,7 +1543,7 @@ post_nm(DECL_ARGS) break; case ROFFT_HEAD: case ROFFT_ELEM: - if (n->child != NULL || meta->name != NULL) + if (n->child != NULL && n->child->string != NULL) font_pop(); break; default: