=================================================================== RCS file: /cvs/mandoc/mdoc_macro.c,v retrieving revision 1.40 retrieving revision 1.41 diff -u -p -r1.40 -r1.41 --- mandoc/mdoc_macro.c 2010/01/01 17:14:29 1.40 +++ mandoc/mdoc_macro.c 2010/01/30 08:42:20 1.41 @@ -1,4 +1,4 @@ -/* $Id: mdoc_macro.c,v 1.40 2010/01/01 17:14:29 kristaps Exp $ */ +/* $Id: mdoc_macro.c,v 1.41 2010/01/30 08:42:20 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -31,6 +31,7 @@ #define REWIND_NOHALT (1 << 1) #define REWIND_HALT (1 << 2) +static int ctx_synopsis(MACRO_PROT_ARGS); static int obsolete(MACRO_PROT_ARGS); static int blk_part_exp(MACRO_PROT_ARGS); static int in_line_eoln(MACRO_PROT_ARGS); @@ -98,7 +99,7 @@ const struct mdoc_macro __mdoc_macros[MDOC_MAX] = { { in_line_eoln, 0 }, /* Rv */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* St */ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Va */ - { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Vt */ + { ctx_synopsis, MDOC_CALLABLE | MDOC_PARSED }, /* Vt */ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Xr */ { in_line_eoln, 0 }, /* %A */ { in_line_eoln, 0 }, /* %B */ @@ -398,6 +399,8 @@ rew_dohalt(int tok, enum mdoc_type type, const struct case (MDOC_Qq): /* FALLTHROUGH */ case (MDOC_Sq): + /* FALLTHROUGH */ + case (MDOC_Vt): assert(MDOC_TAIL != type); if (type == p->type && tok == p->tok) return(REWIND_REWIND); @@ -1317,6 +1320,29 @@ in_line_eoln(MACRO_PROT_ARGS) /* Close out (no delimiters). */ return(rew_elem(m, tok)); +} + + +/* ARGSUSED */ +static int +ctx_synopsis(MACRO_PROT_ARGS) +{ + + /* If we're not in the SYNOPSIS, go straight to in-line. */ + if (SEC_SYNOPSIS != m->lastsec) + return(in_line(m, tok, line, ppos, pos, buf)); + + /* If we're a nested call, same place. */ + if (ppos > 1) + return(in_line(m, tok, line, ppos, pos, buf)); + + /* + * XXX: this will open a block scope; however, if later we end + * up formatting the block scope, then child nodes will inherit + * the formatting. Be careful. + */ + + return(blk_part_imp(m, tok, line, ppos, pos, buf)); }