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 | e60121aa36205c920bf51da52a8b1ca357beb594 (patch) | |
tree | 8d4860c2d4c0b1a2e0e6910484195594fd0cfb87 /mdoc_html.c | |
parent | 45fbe869155402e8d8a4dbfce5516c55d9563890 (diff) | |
download | mandoc-e60121aa36205c920bf51da52a8b1ca357beb594.tar.gz |
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 | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/mdoc_html.c b/mdoc_html.c index 43123028..ed589127 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -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) { |