diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-11-27 22:27:56 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-11-27 22:27:56 +0000 |
commit | 712cc4fb3fddd80d9848fe07c23d27279b248c65 (patch) | |
tree | b5c4c37a9970480b065b6ed0bb471793e17076a1 /mdoc_html.c | |
parent | ae5f77f4afb4eacc8500ded5455086d6242ae946 (diff) | |
download | mandoc-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_html.c')
-rw-r--r-- | mdoc_html.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/mdoc_html.c b/mdoc_html.c index ff388f37..0cd3cf01 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.212 2014/11/27 16:20:31 schwarze Exp $ */ +/* $Id: mdoc_html.c,v 1.213 2014/11/27 22:27:56 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -423,13 +423,12 @@ print_mdoc_node(MDOC_ARGS) * the "meta" table state. This will be reopened on the * next table element. */ - if (h->tblt) { + if (h->tblt != NULL) { print_tblclose(h); t = h->tags.head; } - - assert(NULL == h->tblt); - if (mdocs[n->tok].pre && ENDBODY_NOT == n->end) + assert(h->tblt == NULL); + if (mdocs[n->tok].pre && (n->end == ENDBODY_NOT || n->child)) child = (*mdocs[n->tok].pre)(meta, n, h); break; } @@ -454,8 +453,13 @@ print_mdoc_node(MDOC_ARGS) case MDOC_EQN: break; default: - if (mdocs[n->tok].post && ENDBODY_NOT == n->end) - (*mdocs[n->tok].post)(meta, n, h); + if ( ! mdocs[n->tok].post || n->flags & MDOC_ENDED) + break; + (*mdocs[n->tok].post)(meta, n, h); + if (n->end != ENDBODY_NOT) + n->pending->flags |= MDOC_ENDED; + if (n->end == ENDBODY_NOSPACE) + h->flags |= HTML_NOSPACE; break; } } @@ -2142,10 +2146,11 @@ static void mdoc_quote_post(MDOC_ARGS) { - if (MDOC_BODY != n->type) + if (n->type != MDOC_BODY && n->type != MDOC_ELEM) return; - if (MDOC_En != n->tok) + if ( ! (n->tok == MDOC_En || + (n->tok == MDOC_Eo && n->end == ENDBODY_SPACE))) h->flags |= HTML_NOSPACE; switch (n->tok) { |