diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-01-30 08:42:20 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-01-30 08:42:20 +0000 |
commit | 544544185bcee3b5efb8ee4ccd6c444ea8fef690 (patch) | |
tree | 08cf8012b075ef18f97cccc9904280cf451a2b9f /mdoc_macro.c | |
parent | 69596003d5d304964e0f7f88ac7d957b18ecf9ca (diff) | |
download | mandoc-544544185bcee3b5efb8ee4ccd6c444ea8fef690.tar.gz |
Fix in handling Vt in SYNOPSIS with trailing punctuation. Spotted by Joerg Sonnenberger.
Diffstat (limited to 'mdoc_macro.c')
-rw-r--r-- | mdoc_macro.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/mdoc_macro.c b/mdoc_macro.c index 106a05db..65464c7d 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -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 mdoc_node *p) 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); @@ -1322,6 +1325,29 @@ in_line_eoln(MACRO_PROT_ARGS) /* 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)); +} + + +/* ARGSUSED */ +static int obsolete(MACRO_PROT_ARGS) { |