diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-12-11 14:29:57 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-12-11 14:29:57 +0000 |
commit | 78b3dd3594e0bd21bb808fbd71d461795466e016 (patch) | |
tree | a6f7509e1773a71cc5eb4cc9b5c260bec2b68efe /usr.bin/mandoc | |
parent | ae60ea6c79e69205b7ee0b4ad25d2649563a95d6 (diff) |
Make SYNOPSIS sections and code having .nr nS enabled
behave as if the whole code were wrapped in .Bk/.Ek,
i.e. keeping input lines together on output lines.
This is compatible with new groff behaviour and deviates
from historical groff.
Tweaked version of a patch sent by kristaps@ on July 16, 2010.
ok kristaps@ jmc@ sobrado@ millert@
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r-- | usr.bin/mandoc/mdoc_term.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index f447c24d4b4..65ceb6dd068 100644 --- a/usr.bin/mandoc/mdoc_term.c +++ b/usr.bin/mandoc/mdoc_term.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.115 2010/12/06 22:10:13 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.116 2010/12/11 14:29:56 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org> @@ -319,9 +319,12 @@ 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) { + if (TERMP_KEEP & p->flags || MDOC_SYNPRETTY & n->flags) { if (n->prev && n->prev->line != n->line) { p->flags &= ~TERMP_KEEP; p->flags |= TERMP_PREKEEP; @@ -333,6 +336,16 @@ 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); + if (chld && n->child) print_mdoc_nodelist(p, &npair, m, n->child); |