aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-07-14 15:17:25 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-07-14 15:17:25 +0000
commit36612897332d39fea86a5e0ec1013a54aed57a32 (patch)
tree8734cfc113e96634487a87d4d7a076a2c4d5c513
parentecc1d44cd05807d5bf999f07df1f1232b21d993a (diff)
downloadmandoc-36612897332d39fea86a5e0ec1013a54aed57a32.tar.gz
mandoc-36612897332d39fea86a5e0ec1013a54aed57a32.tar.zst
mandoc-36612897332d39fea86a5e0ec1013a54aed57a32.zip
Removed unnecessary save/restore of style around list prefix.
Added -hang list support.
-rw-r--r--mdoc_term.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index 08ae01d4..13aad112 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -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.
*/