but only within .Nm blocks. Simplify the code accordingly.
This reduces groff-mandoc differences in base by about 2%.
Triggered by research done by Franco Fichtner.
-.Dd $Mdocdate: May 29 2013 $
+.Dd $Mdocdate: December 24 2013 $
.Dt BK-SYNOPSIS 1
.Os OpenBSD
.Sh NAME
.Nm Bk-synopsis
.Nd automatic keeps in the synopsis
.Sh SYNOPSIS
+In the synopsis, almost all macros do not show
+.No the word keep effect they would get in a \&Bk block.
.Nm ksh
.Op Fl +abCefhiklmnpruvXx
.Op Fl +o Ar option
B\bBk\bk-\b-s\bsy\byn\bno\bop\bps\bsi\bis\bs - automatic keeps in the synopsis
S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ In the synopsis, almost all macros do not show the word keep effect they
+ would get in a Bk block.
k\bks\bsh\bh [-\b-+\b+a\bab\bbC\bCe\bef\bfh\bhi\bik\bkl\blm\bmn\bnp\bpr\bru\buv\bvX\bXx\bx] [-\b-+\b+o\bo _\bo_\bp_\bt_\bi_\bo_\bn]
[-\b-c\bc _\bs_\bt_\br_\bi_\bn_\bg | -\b-s\bs | _\bf_\bi_\bl_\be [_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt _\b._\b._\b.]]
k\bks\bsh\bh [-\b-+\b+a\bab\bbC\bCe\bef\bfh\bhi\bik\bkl\blm\bmn\bnp\bpr\bru\buv\bvX\bXx\bx] [-\b-+\b+o\bo _\bo_\bp_\bt_\bi_\bo_\bn]
-/* $Id: mdoc_html.c,v 1.68 2013/12/24 19:10:34 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.69 2013/12/24 20:45:21 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
break;
}
- if (HTML_KEEP & h->flags || MDOC_SYNPRETTY & n->flags) {
+ if (HTML_KEEP & h->flags) {
if (n->prev ? (n->prev->lastline != n->line) :
(n->parent && n->parent->line != n->line)) {
h->flags &= ~HTML_KEEP;
-/* $Id: mdoc_macro.c,v 1.81 2013/12/24 19:10:34 schwarze Exp $ */
+/* $Id: mdoc_macro.c,v 1.82 2013/12/24 20:45:21 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
maxargs = 1;
break;
case (MDOC_Ek):
- if ( ! (MDOC_SYNOPSIS & mdoc->flags))
- mdoc->flags &= ~MDOC_KEEP;
+ mdoc->flags &= ~MDOC_KEEP;
default:
maxargs = 0;
break;
-/* $Id: mdoc_man.c,v 1.52 2013/10/07 22:21:56 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.53 2013/12/24 20:45:21 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
*
pre_sect(DECL_ARGS)
{
- switch (n->type) {
- case (MDOC_HEAD):
+ if (MDOC_HEAD == n->type) {
outflags |= MMAN_sp;
print_block(manacts[n->tok].prefix, 0);
print_word("");
putchar('\"');
outflags &= ~MMAN_spc;
- break;
- case (MDOC_BODY):
- if (MDOC_Sh == n->tok) {
- if (MDOC_SYNPRETTY & n->flags)
- outflags |= MMAN_Bk;
- else
- outflags &= ~MMAN_Bk;
- }
- break;
- default:
- break;
}
return(1);
}
post_bk(DECL_ARGS)
{
- if (MDOC_BODY == n->type && ! (MDOC_SYNPRETTY & n->flags))
+ if (MDOC_BODY == n->type)
outflags &= ~MMAN_Bk;
}
{
char *name;
- if (MDOC_BLOCK == n->type)
+ if (MDOC_BLOCK == n->type) {
+ outflags |= MMAN_Bk;
pre_syn(n);
+ }
if (MDOC_ELEM != n->type && MDOC_HEAD != n->type)
return(1);
name = n->child ? n->child->string : meta->name;
post_nm(DECL_ARGS)
{
- if (MDOC_ELEM != n->type && MDOC_HEAD != n->type)
- return;
- font_pop();
+ switch (n->type) {
+ case (MDOC_BLOCK):
+ outflags &= ~MMAN_Bk;
+ break;
+ case (MDOC_HEAD):
+ /* FALLTHROUGH */
+ case (MDOC_ELEM):
+ font_pop();
+ break;
+ default:
+ break;
+ }
}
static int
-/* $Id: mdoc_term.c,v 1.154 2013/12/24 19:10:34 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.155 2013/12/24 20:45:21 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
/*
* 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;
}
}
- /*
- * 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.
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)
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;
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);
}