=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mdoc_term.c,v retrieving revision 1.44 retrieving revision 1.45 diff -c -r1.44 -r1.45 *** src/usr.bin/mandoc/mdoc_term.c 2009/08/09 19:15:14 1.44 --- src/usr.bin/mandoc/mdoc_term.c 2009/08/09 19:28:21 1.45 *************** *** 1,4 **** ! /* $Id: mdoc_term.c,v 1.44 2009/08/09 19:15:14 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * --- 1,4 ---- ! /* $Id: mdoc_term.c,v 1.45 2009/08/09 19:28:21 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * *************** *** 305,311 **** static size_t arg_offset(const struct mdoc_argv *); static size_t arg_width(const struct mdoc_argv *, int); static int arg_listtype(const struct mdoc_node *); ! static int fmt_block_vspace(struct termp *, const struct mdoc_node *, const struct mdoc_node *); static void print_node(DECL_ARGS); --- 305,311 ---- static size_t arg_offset(const struct mdoc_argv *); static size_t arg_width(const struct mdoc_argv *, int); static int arg_listtype(const struct mdoc_node *); ! static void fmt_block_vspace(struct termp *, const struct mdoc_node *, const struct mdoc_node *); static void print_node(DECL_ARGS); *************** *** 656,662 **** /* ARGSUSED */ ! static int fmt_block_vspace(struct termp *p, const struct mdoc_node *bl, const struct mdoc_node *node) --- 656,662 ---- /* ARGSUSED */ ! static void fmt_block_vspace(struct termp *p, const struct mdoc_node *bl, const struct mdoc_node *node) *************** *** 665,690 **** term_newln(p); ! if (arg_hasattr(MDOC_Compact, bl)) ! return(1); ! /* XXX - not documented! */ ! else if (arg_hasattr(MDOC_Column, bl)) ! return(1); for (n = node; n; n = n->parent) { if (MDOC_BLOCK != n->type) continue; if (MDOC_Ss == n->tok) ! break; if (MDOC_Sh == n->tok) ! break; if (NULL == n->prev) continue; - term_vspace(p); break; } ! return(1); } --- 665,711 ---- term_newln(p); ! if (MDOC_Bl == bl->tok && arg_hasattr(MDOC_Compact, bl)) ! return; + /* + * Search through our prior nodes. If we follow a `Ss' or `Sh', + * then don't vspace. + */ + for (n = node; n; n = n->parent) { if (MDOC_BLOCK != n->type) continue; if (MDOC_Ss == n->tok) ! return; if (MDOC_Sh == n->tok) ! return; if (NULL == n->prev) continue; break; } ! /* ! * XXX - not documented: a `-column' does not ever assert vspace ! * within the list. ! */ ! ! if (MDOC_Bl == bl->tok && arg_hasattr(MDOC_Column, bl)) ! if (node->prev && MDOC_It == node->prev->tok) ! return; ! ! /* ! * XXX - not documented: a `-diag' without a body does not ! * assert a vspace prior to the next element. ! */ ! if (MDOC_Bl == bl->tok && arg_hasattr(MDOC_Diag, bl)) ! if (node->prev && MDOC_It == node->prev->tok) { ! assert(node->prev->body); ! if (NULL == node->prev->body->child) ! return; ! } ! ! term_vspace(p); } *************** *** 724,731 **** int i, type, keys[3], vals[3]; size_t width, offset; ! if (MDOC_BLOCK == node->type) ! return(fmt_block_vspace(p, node->parent->parent, node)); bl = node->parent->parent->parent; --- 745,754 ---- int i, type, keys[3], vals[3]; size_t width, offset; ! if (MDOC_BLOCK == node->type) { ! fmt_block_vspace(p, node->parent->parent, node); ! return(1); ! } bl = node->parent->parent->parent; *************** *** 1528,1537 **** * line. Blank lines are allowed. */ ! if (MDOC_BLOCK == node->type) ! return(fmt_block_vspace(p, node, node)); ! else if (MDOC_BODY != node->type) return(1); /* FIXME: display type should be mandated by parser. */ --- 1551,1561 ---- * line. Blank lines are allowed. */ ! if (MDOC_BLOCK == node->type) { ! fmt_block_vspace(p, node, node); return(1); + } else if (MDOC_BODY != node->type) + return(1); /* FIXME: display type should be mandated by parser. */ *************** *** 1706,1711 **** --- 1730,1745 ---- /* ARGSUSED */ static int + termp_pa_pre(DECL_ARGS) + { + + pair->flag |= ttypes[TTYPE_FILE]; + return(1); + } + + + /* ARGSUSED */ + static int termp_pf_pre(DECL_ARGS) { *************** *** 1754,1769 **** if (MDOC_HEAD == node->type) term_newln(p); - } - - - /* ARGSUSED */ - static int - termp_pa_pre(DECL_ARGS) - { - - pair->flag |= ttypes[TTYPE_FILE]; - return(1); } --- 1788,1793 ----