diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2013-12-24 20:45:27 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2013-12-24 20:45:27 +0000 |
commit | 472637a00de4c03052114688d7473918eb455561 (patch) | |
tree | e3ad1192f26e0fec58145953e745e833430faacd /mdoc_term.c | |
parent | 8d226e7d9f28fbbca5bd6969e8fe3e6ee69ec94e (diff) | |
download | mandoc-472637a00de4c03052114688d7473918eb455561.tar.gz |
It turns out SYNOPSIS mode does not imply .Bk in general,
but only within .Nm blocks. Simplify the code accordingly.
Triggered by research done by Franco Fichtner.
Diffstat (limited to 'mdoc_term.c')
-rw-r--r-- | mdoc_term.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/mdoc_term.c b/mdoc_term.c index 1eaa47db..e2adafd2 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -307,12 +307,9 @@ print_mdoc_node(DECL_ARGS) /* * Keeps only work until the end of a line. If a keep was * invoked in a prior line, revert it to PREKEEP. - * - * Also let SYNPRETTY sections behave as if they were wrapped - * in a `Bk' block. */ - if (TERMP_KEEP & p->flags || MDOC_SYNPRETTY & n->flags) { + if (TERMP_KEEP & p->flags) { if (n->prev ? (n->prev->lastline != n->line) : (n->parent && n->parent->line != n->line)) { p->flags &= ~TERMP_KEEP; @@ -321,16 +318,6 @@ print_mdoc_node(DECL_ARGS) } /* - * Since SYNPRETTY sections aren't "turned off" with `Ek', - * we have to intuit whether we should disable formatting. - */ - - if ( ! (MDOC_SYNPRETTY & n->flags) && - ((n->prev && MDOC_SYNPRETTY & n->prev->flags) || - (n->parent && MDOC_SYNPRETTY & n->parent->flags))) - p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP); - - /* * After the keep flags have been set up, we may now * produce output. Note that some pre-handlers do so. */ @@ -1010,8 +997,10 @@ static int termp_nm_pre(DECL_ARGS) { - if (MDOC_BLOCK == n->type) + if (MDOC_BLOCK == n->type) { + p->flags |= TERMP_PREKEEP; return(1); + } if (MDOC_BODY == n->type) { if (NULL == n->child) @@ -1060,7 +1049,9 @@ static void termp_nm_post(DECL_ARGS) { - if (MDOC_HEAD == n->type && n->next->child) { + if (MDOC_BLOCK == n->type) { + p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP); + } else if (MDOC_HEAD == n->type && n->next->child) { term_flushln(p); p->flags &= ~(TERMP_NOBREAK | TERMP_HANG); p->trailspace = 0; @@ -2240,7 +2231,7 @@ static void termp_bk_post(DECL_ARGS) { - if (MDOC_BODY == n->type && ! (MDOC_SYNPRETTY & n->flags)) + if (MDOC_BODY == n->type) p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP); } |