aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_man.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-11-27 22:27:56 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-11-27 22:27:56 +0000
commit712cc4fb3fddd80d9848fe07c23d27279b248c65 (patch)
treeb5c4c37a9970480b065b6ed0bb471793e17076a1 /mdoc_man.c
parentae5f77f4afb4eacc8500ded5455086d6242ae946 (diff)
downloadmandoc-712cc4fb3fddd80d9848fe07c23d27279b248c65.tar.gz
mandoc-712cc4fb3fddd80d9848fe07c23d27279b248c65.tar.zst
mandoc-712cc4fb3fddd80d9848fe07c23d27279b248c65.zip
Multiple fixes with respect to .Eo:
1. Correctly parse stray .Ec without preceding .Eo, avoiding an assertion violation found by jsg@ with afl. 2. Correctly parse .Ec arguments when breaking another block. 3. Correct spacing around closing delimiter when breaking another block. 4. Sync some related formatting control from -Tascii to -Thtml.
Diffstat (limited to 'mdoc_man.c')
-rw-r--r--mdoc_man.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/mdoc_man.c b/mdoc_man.c
index 33e8b2cb..41cc65b5 100644
--- a/mdoc_man.c
+++ b/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_man.c,v 1.75 2014/11/27 16:20:31 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.76 2014/11/27 22:27:56 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -85,6 +85,7 @@ static int pre_en(DECL_ARGS);
static int pre_enc(DECL_ARGS);
static int pre_em(DECL_ARGS);
static int pre_skip(DECL_ARGS);
+static int pre_eo(DECL_ARGS);
static int pre_ex(DECL_ARGS);
static int pre_fa(DECL_ARGS);
static int pre_fd(DECL_ARGS);
@@ -190,7 +191,7 @@ static const struct manact manacts[MDOC_MAX + 1] = {
{ NULL, NULL, NULL, NULL, NULL }, /* Ec */
{ NULL, NULL, NULL, NULL, NULL }, /* Ef */
{ NULL, pre_em, post_font, NULL, NULL }, /* Em */
- { NULL, NULL, post_eo, NULL, NULL }, /* Eo */
+ { cond_body, pre_eo, post_eo, NULL, NULL }, /* Eo */
{ NULL, pre_ux, NULL, "FreeBSD", NULL }, /* Fx */
{ NULL, pre_sy, post_font, NULL, NULL }, /* Ms */
{ NULL, pre_no, NULL, NULL, NULL }, /* No */
@@ -607,8 +608,8 @@ print_node(DECL_ARGS)
* node.
*/
act = manacts + n->tok;
- cond = NULL == act->cond || (*act->cond)(meta, n);
- if (cond && act->pre && ENDBODY_NOT == n->end)
+ cond = act->cond == NULL || (*act->cond)(meta, n);
+ if (cond && act->pre && (n->end == ENDBODY_NOT || n->nchild))
do_sub = (*act->pre)(meta, n);
}
@@ -1123,11 +1124,19 @@ post_en(DECL_ARGS)
return;
}
+static int
+pre_eo(DECL_ARGS)
+{
+
+ outflags &= ~(MMAN_spc | MMAN_nl);
+ return(1);
+}
+
static void
post_eo(DECL_ARGS)
{
- if (MDOC_HEAD == n->type || MDOC_BODY == n->type)
+ if (n->end != ENDBODY_SPACE)
outflags &= ~MMAN_spc;
}