=================================================================== RCS file: /cvs/mandoc/man_term.c,v retrieving revision 1.135 retrieving revision 1.137 diff -u -p -r1.135 -r1.137 --- mandoc/man_term.c 2012/11/17 00:26:33 1.135 +++ mandoc/man_term.c 2013/10/17 20:54:58 1.137 @@ -1,7 +1,7 @@ -/* $Id: man_term.c,v 1.135 2012/11/17 00:26:33 schwarze Exp $ */ +/* $Id: man_term.c,v 1.137 2013/10/17 20:54:58 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons - * Copyright (c) 2010, 2011, 2012 Ingo Schwarze + * Copyright (c) 2010, 2011, 2012, 2013 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -78,6 +78,7 @@ static int pre_RS(DECL_ARGS); static int pre_SH(DECL_ARGS); static int pre_SS(DECL_ARGS); static int pre_TP(DECL_ARGS); +static int pre_UR(DECL_ARGS); static int pre_alternate(DECL_ARGS); static int pre_ft(DECL_ARGS); static int pre_ign(DECL_ARGS); @@ -91,6 +92,7 @@ static void post_RS(DECL_ARGS); static void post_SH(DECL_ARGS); static void post_SS(DECL_ARGS); static void post_TP(DECL_ARGS); +static void post_UR(DECL_ARGS); static const struct termact termacts[MAN_MAX] = { { pre_sp, NULL, MAN_NOTEXT }, /* br */ @@ -129,6 +131,8 @@ static const struct termact termacts[MAN_MAX] = { { pre_OP, NULL, 0 }, /* OP */ { pre_literal, NULL, 0 }, /* EX */ { pre_literal, NULL, 0 }, /* EE */ + { pre_UR, post_UR, 0 }, /* UR */ + { NULL, NULL, 0 }, /* UE */ }; @@ -564,7 +568,7 @@ post_HP(DECL_ARGS) switch (n->type) { case (MAN_BODY): - term_flushln(p); + term_newln(p); p->flags &= ~TERMP_NOBREAK; p->flags &= ~TERMP_TWOSPACE; p->offset = mt->offset; @@ -939,7 +943,33 @@ post_RS(DECL_ARGS) mt->lmargincur = mt->lmarginsz; } +/* ARGSUSED */ +static int +pre_UR(DECL_ARGS) +{ + + return (MAN_HEAD != n->type); +} + +/* ARGSUSED */ static void +post_UR(DECL_ARGS) +{ + + if (MAN_BLOCK != n->type) + return; + + term_word(p, "<"); + p->flags |= TERMP_NOSPACE; + + if (NULL != n->child->child) + print_man_node(p, mt, n->child->child, meta); + + p->flags |= TERMP_NOSPACE; + term_word(p, ">"); +} + +static void print_man_node(DECL_ARGS) { size_t rm, rmax; @@ -1001,7 +1031,7 @@ out: * more specific than this. */ if (MANT_LITERAL & mt->fl && ! (TERMP_NOBREAK & p->flags) && - NULL != n->next && n->next->line > n->line) { + (NULL == n->next || n->next->line > n->line)) { rm = p->rmargin; rmax = p->maxrmargin; p->rmargin = p->maxrmargin = TERM_MAXMARGIN;