]> git.cameronkatri.com Git - mandoc.git/commitdiff
Removed unnecessary save/restore of style around list prefix.
authorKristaps Dzonsons <kristaps@bsd.lv>
Tue, 14 Jul 2009 15:17:25 +0000 (15:17 +0000)
committerKristaps Dzonsons <kristaps@bsd.lv>
Tue, 14 Jul 2009 15:17:25 +0000 (15:17 +0000)
Added -hang list support.

mdoc_term.c

index 08ae01d4af13dca6f4b32bbbf594c61686991d3b..13aad1122f063fb15021af79684e25959fb3550f 100644 (file)
@@ -1,4 +1,4 @@
-/*     $Id: mdoc_term.c,v 1.38 2009/07/13 07:23:07 kristaps Exp $ */
+/*     $Id: mdoc_term.c,v 1.39 2009/07/14 15:17:25 kristaps Exp $ */
 /*
  * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
  *
@@ -700,7 +700,7 @@ termp_it_pre(DECL_ARGS)
 {
        const struct mdoc_node *bl, *n;
        char                    buf[7];
-       int                     i, type, keys[3], vals[3], sv;
+       int                     i, type, keys[3], vals[3];
        size_t                  width, offset;
 
        if (MDOC_BLOCK == node->type)
@@ -769,7 +769,9 @@ termp_it_pre(DECL_ARGS)
                        width = 5;
                break;
        case (MDOC_Hang):
-               /* FALLTHROUGH */
+               if (0 == width)
+                       width = 8;
+               break;
        case (MDOC_Tag):
                if (0 == width)
                        width = 10;
@@ -787,8 +789,6 @@ termp_it_pre(DECL_ARGS)
        case (MDOC_Diag):
                term_word(p, "\\ ");
                /* FALLTHROUGH */
-       case (MDOC_Hang):
-               /* FALLTHROUGH */
        case (MDOC_Inset):
                if (MDOC_BODY == node->type) 
                        p->flags &= ~TERMP_NOSPACE;
@@ -829,22 +829,30 @@ termp_it_pre(DECL_ARGS)
        case (MDOC_Enum):
                /* FALLTHROUGH */
        case (MDOC_Hyphen):
-               /* FALLTHROUGH */
+               if (MDOC_HEAD == node->type)
+                       p->flags |= TERMP_NOBREAK;
+               else
+                       p->flags |= TERMP_NOLPAD;
+               break;
        case (MDOC_Hang):
-               /* FALLTHROUGH */
-       case (MDOC_Tag):
                if (MDOC_HEAD == node->type)
                        p->flags |= TERMP_NOBREAK;
                else
                        p->flags |= TERMP_NOLPAD;
 
-               if (MDOC_HEAD == node->type && MDOC_Hang == type)
-                       p->flags |= TERMP_NONOBREAK;
+               if (MDOC_HEAD == node->type)
+                       p->flags |= TERMP_HANG;
+               break;
+       case (MDOC_Tag):
+               if (MDOC_HEAD == node->type)
+                       p->flags |= TERMP_NOBREAK;
+               else
+                       p->flags |= TERMP_NOLPAD;
 
-               if (MDOC_HEAD == node->type && MDOC_Tag == type)
-                       if (NULL == node->next ||
-                                       NULL == node->next->child)
-                               p->flags |= TERMP_NONOBREAK;
+               if (MDOC_HEAD != node->type)
+                       break;
+               if (NULL == node->next || NULL == node->next->child)
+                       p->flags |= TERMP_DANGLE;
                break;
        case (MDOC_Column):
                if (MDOC_HEAD == node->type) {
@@ -902,18 +910,19 @@ termp_it_pre(DECL_ARGS)
         * HEAD character (temporarily bold, in some cases).  
         */
 
-       sv = p->flags;
        if (MDOC_HEAD == node->type)
                switch (type) {
                case (MDOC_Bullet):
                        p->flags |= TERMP_BOLD;
                        term_word(p, "\\[bu]");
+                       p->flags &= ~TERMP_BOLD;
                        break;
                case (MDOC_Dash):
                        /* FALLTHROUGH */
                case (MDOC_Hyphen):
                        p->flags |= TERMP_BOLD;
                        term_word(p, "\\(hy");
+                       p->flags &= ~TERMP_BOLD;
                        break;
                case (MDOC_Enum):
                        (pair->ppair->ppair->count)++;
@@ -925,8 +934,6 @@ termp_it_pre(DECL_ARGS)
                        break;
                }
 
-       p->flags = sv; /* Restore saved flags. */
-
        /* 
         * If we're not going to process our children, indicate so here.
         */