=================================================================== RCS file: /cvs/mandoc/mdoc_man.c,v retrieving revision 1.112 retrieving revision 1.116 diff -u -p -r1.112 -r1.116 --- mandoc/mdoc_man.c 2017/05/05 13:17:55 1.112 +++ mandoc/mdoc_man.c 2017/05/30 16:31:29 1.116 @@ -1,4 +1,4 @@ -/* $Id: mdoc_man.c,v 1.112 2017/05/05 13:17:55 schwarze Exp $ */ +/* $Id: mdoc_man.c,v 1.116 2017/05/30 16:31:29 schwarze Exp $ */ /* * Copyright (c) 2011-2017 Ingo Schwarze * @@ -73,7 +73,6 @@ static void post_nm(DECL_ARGS); static void post_percent(DECL_ARGS); static void post_pf(DECL_ARGS); static void post_sect(DECL_ARGS); -static void post_sp(DECL_ARGS); static void post_vt(DECL_ARGS); static int pre__t(DECL_ARGS); static int pre_an(DECL_ARGS); @@ -102,17 +101,18 @@ static int pre_in(DECL_ARGS); static int pre_it(DECL_ARGS); static int pre_lk(DECL_ARGS); static int pre_li(DECL_ARGS); -static void pre_ll(DECL_ARGS); static int pre_nm(DECL_ARGS); static int pre_no(DECL_ARGS); static int pre_ns(DECL_ARGS); +static void pre_onearg(DECL_ARGS); static int pre_pp(DECL_ARGS); static int pre_rs(DECL_ARGS); static int pre_sm(DECL_ARGS); -static int pre_sp(DECL_ARGS); +static void pre_sp(DECL_ARGS); static int pre_sect(DECL_ARGS); static int pre_sy(DECL_ARGS); static void pre_syn(const struct roff_node *); +static void pre_ta(DECL_ARGS); static int pre_vt(DECL_ARGS); static int pre_xr(DECL_ARGS); static void print_word(const char *); @@ -127,7 +127,10 @@ static void print_node(DECL_ARGS); static const void_fp roff_manacts[ROFF_MAX] = { pre_br, pre_ft, - pre_ll, + pre_onearg, + pre_sp, + pre_ta, + pre_onearg, }; static const struct manact __manacts[MDOC_MAX - MDOC_Dd] = { @@ -249,7 +252,6 @@ static const struct manact __manacts[MDOC_MAX - MDOC_D { cond_body, pre_en, post_en, NULL, NULL }, /* En */ { NULL, NULL, NULL, NULL, NULL }, /* Dx */ { NULL, NULL, post_percent, NULL, NULL }, /* %Q */ - { NULL, pre_sp, post_sp, NULL, NULL }, /* sp */ { NULL, NULL, post_percent, NULL, NULL }, /* %U */ { NULL, NULL, NULL, NULL, NULL }, /* Ta */ }; @@ -444,7 +446,6 @@ static void print_line(const char *s, int newflags) { - outflags &= ~MMAN_br; outflags |= MMAN_nl; print_word(s); outflags |= newflags; @@ -1526,16 +1527,22 @@ post_lb(DECL_ARGS) static int pre_lk(DECL_ARGS) { - const struct roff_node *link, *descr; + const struct roff_node *link, *descr, *punct; int display; if ((link = n->child) == NULL) return 0; + /* Find beginning of trailing punctuation. */ + punct = n->last; + while (punct != link && punct->flags & NODE_DELIMC) + punct = punct->prev; + punct = punct->next; + /* Link text. */ - if ((descr = link->next) != NULL && !(descr->flags & NODE_DELIMC)) { + if ((descr = link->next) != NULL && descr != punct) { font_push('I'); - while (descr != NULL && !(descr->flags & NODE_DELIMC)) { + while (descr != punct) { print_word(descr->string); descr = descr->next; } @@ -1555,9 +1562,9 @@ pre_lk(DECL_ARGS) font_pop(); /* Trailing punctuation. */ - while (descr != NULL) { - print_word(descr->string); - descr = descr->next; + while (punct != NULL) { + print_word(punct->string); + punct = punct->next; } if (display) print_line(".RE", MMAN_nl); @@ -1565,9 +1572,12 @@ pre_lk(DECL_ARGS) } static void -pre_ll(DECL_ARGS) +pre_onearg(DECL_ARGS) { - print_line(".ll", 0); + outflags |= MMAN_nl; + print_word("."); + outflags &= ~MMAN_spc; + print_word(roff_name[n->tok]); if (n->child != NULL) print_word(n->child->string); outflags |= MMAN_nl; @@ -1694,22 +1704,17 @@ pre_sm(DECL_ARGS) return 0; } -static int +static void pre_sp(DECL_ARGS) { - - if (MMAN_PP & outflags) { + if (outflags & MMAN_PP) { outflags &= ~MMAN_PP; print_line(".PP", 0); - } else + } else { print_line(".sp", 0); - return 1; -} - -static void -post_sp(DECL_ARGS) -{ - + if (n->child != NULL) + print_word(n->child->string); + } outflags |= MMAN_nl; } @@ -1719,6 +1724,15 @@ pre_sy(DECL_ARGS) font_push('B'); return 1; +} + +static void +pre_ta(DECL_ARGS) +{ + print_line(".ta", 0); + for (n = n->child; n != NULL; n = n->next) + print_word(n->string); + outflags |= MMAN_nl; } static int