=================================================================== RCS file: /cvs/mandoc/mdoc_term.c,v retrieving revision 1.188 retrieving revision 1.193 diff -u -p -r1.188 -r1.193 --- mandoc/mdoc_term.c 2010/09/26 09:16:02 1.188 +++ mandoc/mdoc_term.c 2010/10/10 09:59:48 1.193 @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.188 2010/09/26 09:16:02 kristaps Exp $ */ +/* $Id: mdoc_term.c,v 1.193 2010/10/10 09:59:48 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze @@ -81,7 +81,6 @@ static void termp_lb_post(DECL_ARGS); static void termp_nm_post(DECL_ARGS); static void termp_pf_post(DECL_ARGS); static void termp_quote_post(DECL_ARGS); -static void termp_quote_post(DECL_ARGS); static void termp_sh_post(DECL_ARGS); static void termp_ss_post(DECL_ARGS); @@ -103,6 +102,7 @@ static int termp_fl_pre(DECL_ARGS); static int termp_fn_pre(DECL_ARGS); static int termp_fo_pre(DECL_ARGS); static int termp_ft_pre(DECL_ARGS); +static int termp_igndelim_pre(DECL_ARGS); static int termp_in_pre(DECL_ARGS); static int termp_it_pre(DECL_ARGS); static int termp_li_pre(DECL_ARGS); @@ -110,7 +110,6 @@ static int termp_lk_pre(DECL_ARGS); static int termp_nd_pre(DECL_ARGS); static int termp_nm_pre(DECL_ARGS); static int termp_ns_pre(DECL_ARGS); -static int termp_pf_pre(DECL_ARGS); static int termp_quote_pre(DECL_ARGS); static int termp_rs_pre(DECL_ARGS); static int termp_rv_pre(DECL_ARGS); @@ -197,12 +196,12 @@ static const struct termact termacts[MDOC_MAX] = { { NULL, NULL }, /* Eo */ { termp_xx_pre, NULL }, /* Fx */ { termp_bold_pre, NULL }, /* Ms */ - { NULL, NULL }, /* No */ + { termp_igndelim_pre, NULL }, /* No */ { termp_ns_pre, NULL }, /* Ns */ { termp_xx_pre, NULL }, /* Nx */ { termp_xx_pre, NULL }, /* Ox */ { NULL, NULL }, /* Pc */ - { termp_pf_pre, termp_pf_post }, /* Pf */ + { termp_igndelim_pre, termp_pf_post }, /* Pf */ { termp_quote_pre, termp_quote_post }, /* Po */ { termp_quote_pre, termp_quote_post }, /* Pq */ { NULL, NULL }, /* Qc */ @@ -1578,6 +1577,28 @@ termp_bd_pre(DECL_ARGS) for (nn = n->child; nn; nn = nn->next) { print_mdoc_node(p, pair, m, nn); + /* + * If the printed node flushes its own line, then we + * needn't do it here as well. This is hacky, but the + * notion of selective eoln whitespace is pretty dumb + * anyway, so don't sweat it. + */ + switch (nn->tok) { + case (MDOC_Sm): + /* FALLTHROUGH */ + case (MDOC_br): + /* FALLTHROUGH */ + case (MDOC_sp): + /* FALLTHROUGH */ + case (MDOC_Bl): + /* FALLTHROUGH */ + case (MDOC_Lp): + /* FALLTHROUGH */ + case (MDOC_Pp): + continue; + default: + break; + } if (nn->next && nn->next->line == nn->line) continue; term_flushln(p); @@ -1665,7 +1686,7 @@ termp_xx_pre(DECL_ARGS) /* ARGSUSED */ static int -termp_pf_pre(DECL_ARGS) +termp_igndelim_pre(DECL_ARGS) { p->flags |= TERMP_IGNDELIM; @@ -1678,7 +1699,6 @@ static void termp_pf_post(DECL_ARGS) { - p->flags &= ~TERMP_IGNDELIM; p->flags |= TERMP_NOSPACE; } @@ -1796,6 +1816,7 @@ termp_sp_pre(DECL_ARGS) } +/* ARGSUSED */ static int termp_quote_pre(DECL_ARGS) { @@ -1855,6 +1876,7 @@ termp_quote_pre(DECL_ARGS) } +/* ARGSUSED */ static void termp_quote_post(DECL_ARGS) {