=================================================================== RCS file: /cvs/mandoc/mdoc_html.c,v retrieving revision 1.211 retrieving revision 1.217 diff -u -p -r1.211 -r1.217 --- mandoc/mdoc_html.c 2014/11/19 22:00:37 1.211 +++ mandoc/mdoc_html.c 2014/12/23 09:31:46 1.217 @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.211 2014/11/19 22:00:37 schwarze Exp $ */ +/* $Id: mdoc_html.c,v 1.217 2014/12/23 09:31:46 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * Copyright (c) 2014 Ingo Schwarze @@ -26,11 +26,10 @@ #include #include -#include "mandoc.h" #include "mandoc_aux.h" +#include "mdoc.h" #include "out.h" #include "html.h" -#include "mdoc.h" #include "main.h" #define INDENT 5 @@ -183,7 +182,7 @@ static const struct htmlmdoc mdocs[MDOC_MAX] = { {mdoc_quote_pre, mdoc_quote_post}, /* Bq */ {mdoc_xx_pre, NULL}, /* Bsx */ {mdoc_bx_pre, NULL}, /* Bx */ - {NULL, NULL}, /* Db */ + {mdoc_skip_pre, NULL}, /* Db */ {NULL, NULL}, /* Dc */ {mdoc_quote_pre, mdoc_quote_post}, /* Do */ {mdoc_quote_pre, mdoc_quote_post}, /* Dq */ @@ -280,7 +279,7 @@ static void a2width(const char *p, struct roffsu *su) { - if ( ! a2roffsu(p, su, SCALE_MAX)) { + if (a2roffsu(p, su, SCALE_MAX) < 2) { su->unit = SCALE_EN; su->scale = html_strlen(p); } @@ -423,13 +422,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 +452,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; } } @@ -1198,7 +1201,8 @@ mdoc_bd_pre(MDOC_ARGS) default: break; } - if (nn->next && nn->next->line == nn->line) + if (h->flags & HTML_NONEWLINE || + (nn->next && ! (nn->next->flags & MDOC_LINE))) continue; else if (nn->next) print_text(h, "\n"); @@ -1564,7 +1568,7 @@ mdoc_sp_pre(MDOC_ARGS) if (MDOC_sp == n->tok) { if (NULL != (n = n->child)) if ( ! a2roffsu(n->string, &su, SCALE_VS)) - SCALE_VS_INIT(&su, atoi(n->string)); + su.scale = 1.0; } else su.scale = 0.0; @@ -1865,7 +1869,8 @@ static void mdoc_pf_post(MDOC_ARGS) { - h->flags |= HTML_NOSPACE; + if ( ! (n->next == NULL || n->next->flags & MDOC_LINE)) + h->flags |= HTML_NOSPACE; } static int @@ -2142,10 +2147,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) {