aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_man.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2013-12-24 20:45:27 +0000
committerIngo Schwarze <schwarze@openbsd.org>2013-12-24 20:45:27 +0000
commitc28713a310b996133153932ab47ff94f3cb06211 (patch)
tree39b1e55bb4cad6e0544e948771e89e1034969075 /mdoc_man.c
parentb303922601f56d18c6f93423c4ff3d27382f885e (diff)
downloadmandoc-c28713a310b996133153932ab47ff94f3cb06211.tar.gz
mandoc-c28713a310b996133153932ab47ff94f3cb06211.tar.zst
mandoc-c28713a310b996133153932ab47ff94f3cb06211.zip
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_man.c')
-rw-r--r--mdoc_man.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/mdoc_man.c b/mdoc_man.c
index b316c874..97b3a78e 100644
--- a/mdoc_man.c
+++ b/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_man.c,v 1.53 2013/10/07 22:22:10 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.54 2013/12/24 20:45:27 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -705,24 +705,12 @@ static int
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);
}
@@ -900,7 +888,7 @@ static void
post_bk(DECL_ARGS)
{
- if (MDOC_BODY == n->type && ! (MDOC_SYNPRETTY & n->flags))
+ if (MDOC_BODY == n->type)
outflags &= ~MMAN_Bk;
}
@@ -1408,8 +1396,10 @@ pre_nm(DECL_ARGS)
{
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;
@@ -1432,9 +1422,18 @@ static void
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