]> git.cameronkatri.com Git - mandoc.git/blobdiff - mdoc_html.c
The st_size member of struct stat is off_t, which is signed,
[mandoc.git] / mdoc_html.c
index bc89a4af28ce4f23d9a5e2c3a9715d11539116e2..fba7fb6fa4aba62086df1cc3f476c0e27d62ae9c 100644 (file)
@@ -1,4 +1,4 @@
-/*     $Id: mdoc_html.c,v 1.221 2015/02/01 23:10:35 schwarze Exp $ */
+/*     $Id: mdoc_html.c,v 1.226 2015/03/03 21:11:34 schwarze Exp $ */
 /*
  * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -35,7 +35,7 @@
 #define        INDENT           5
 
 #define        MDOC_ARGS         const struct mdoc_meta *meta, \
-                         const struct mdoc_node *n, \
+                         struct mdoc_node *n, \
                          struct html *h
 
 #ifndef MIN
@@ -267,7 +267,7 @@ void
 html_mdoc(void *arg, const struct mdoc *mdoc)
 {
 
-       print_mdoc(mdoc_meta(mdoc), mdoc_node(mdoc),
+       print_mdoc(mdoc_meta(mdoc), mdoc_node(mdoc)->child,
            (struct html *)arg);
        putchar('\n');
 }
@@ -387,6 +387,7 @@ print_mdoc_node(MDOC_ARGS)
 
        child = 1;
        t = h->tags.head;
+       n->flags &= ~MDOC_ENDED;
 
        switch (n->type) {
        case MDOC_ROOT:
@@ -410,6 +411,8 @@ print_mdoc_node(MDOC_ARGS)
                        h->flags |= HTML_NOSPACE;
                return;
        case MDOC_EQN:
+               if (n->flags & MDOC_LINE)
+                       putchar('\n');
                print_eqn(h, n->eqn);
                break;
        case MDOC_TBL:
@@ -436,12 +439,9 @@ print_mdoc_node(MDOC_ARGS)
                break;
        }
 
-       if (HTML_KEEP & h->flags) {
-               if (n->prev ? (n->prev->lastline != n->line) :
-                   (n->parent && n->parent->line != n->line)) {
-                       h->flags &= ~HTML_KEEP;
-                       h->flags |= HTML_PREKEEP;
-               }
+       if (h->flags & HTML_KEEP && n->flags & MDOC_LINE) {
+               h->flags &= ~HTML_KEEP;
+               h->flags |= HTML_PREKEEP;
        }
 
        if (child && n->child)
@@ -460,7 +460,7 @@ print_mdoc_node(MDOC_ARGS)
                        break;
                (*mdocs[n->tok].post)(meta, n, h);
                if (n->end != ENDBODY_NOT)
-                       n->pending->flags |= MDOC_ENDED;
+                       n->body->flags |= MDOC_ENDED;
                if (n->end == ENDBODY_NOSPACE)
                        h->flags |= HTML_NOSPACE;
                break;
@@ -1125,7 +1125,7 @@ mdoc_bd_pre(MDOC_ARGS)
 {
        struct htmlpair          tag[2];
        int                      comp, sv;
-       const struct mdoc_node  *nn;
+       struct mdoc_node        *nn;
        struct roffsu            su;
 
        if (MDOC_HEAD == n->type)
@@ -1256,9 +1256,6 @@ mdoc_an_pre(MDOC_ARGS)
                return(0);
        }
 
-       if (n->child == NULL)
-               return(0);
-
        if (h->flags & HTML_SPLIT)
                print_otag(h, TAG_BR, 0, NULL);
 
@@ -2226,9 +2223,8 @@ mdoc_eo_pre(MDOC_ARGS)
            n->child->end != ENDBODY_NOT)
                print_text(h, "\\&");
        else if (n->end != ENDBODY_NOT ? n->child != NULL :
-           n->parent->head->child != NULL &&
-           (n->parent->body->child != NULL ||
-            n->parent->tail->child != NULL))
+           n->parent->head->child != NULL && (n->child != NULL ||
+           (n->parent->tail != NULL && n->parent->tail->child != NULL)))
                h->flags |= HTML_NOSPACE;
        return(1);
 }