=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mdoc_term.c,v retrieving revision 1.103 retrieving revision 1.104 diff -c -r1.103 -r1.104 *** src/usr.bin/mandoc/mdoc_term.c 2010/08/21 14:00:59 1.103 --- src/usr.bin/mandoc/mdoc_term.c 2010/09/20 20:02:27 1.104 *************** *** 1,4 **** ! /* $Id: mdoc_term.c,v 1.103 2010/08/21 14:00:59 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze --- 1,4 ---- ! /* $Id: mdoc_term.c,v 1.104 2010/09/20 20:02:27 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze *************** *** 88,93 **** --- 88,94 ---- static void termp_sq_post(DECL_ARGS); static void termp_ss_post(DECL_ARGS); + static int termp__a_pre(DECL_ARGS); static int termp_an_pre(DECL_ARGS); static int termp_ap_pre(DECL_ARGS); static int termp_aq_pre(DECL_ARGS); *************** *** 174,180 **** { termp_under_pre, NULL }, /* Va */ { termp_vt_pre, NULL }, /* Vt */ { termp_xr_pre, NULL }, /* Xr */ ! { NULL, termp____post }, /* %A */ { termp_under_pre, termp____post }, /* %B */ { NULL, termp____post }, /* %D */ { termp_under_pre, termp____post }, /* %I */ --- 175,181 ---- { termp_under_pre, NULL }, /* Va */ { termp_vt_pre, NULL }, /* Vt */ { termp_xr_pre, NULL }, /* Xr */ ! { termp__a_pre, termp____post }, /* %A */ { termp_under_pre, termp____post }, /* %B */ { NULL, termp____post }, /* %D */ { termp_under_pre, termp____post }, /* %I */ *************** *** 1075,1080 **** --- 1076,1094 ---- /* ARGSUSED */ static int + termp__a_pre(DECL_ARGS) + { + + if (n->prev && MDOC__A == n->prev->tok) + if (NULL == n->next || MDOC__A != n->next->tok) + term_word(p, "and"); + + return(1); + } + + + /* ARGSUSED */ + static int termp_an_pre(DECL_ARGS) { *************** *** 2093,2098 **** --- 2107,2122 ---- static void termp____post(DECL_ARGS) { + + /* + * Handle lists of authors. In general, print each followed by + * a comma. Don't print the comma if there are only two + * authors. + */ + if (MDOC__A == n->tok && n->next && MDOC__A == n->next->tok) + if (NULL == n->next->next || MDOC__A != n->next->next->tok) + if (NULL == n->prev || MDOC__A != n->prev->tok) + return; /* TODO: %U. */