summaryrefslogtreecommitdiffstats
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
commit1aeffd06ef23e334ada54a5997652946127819de (patch)
treeb80dfd91fb4daa9c6f3dd5b1cf9f84d676dceaa4
parentf7e31689c2fad66532268b5f5000d7b59405a613 (diff)
downloadmandoc-1aeffd06ef23e334ada54a5997652946127819de.tar.gz
Removed unnecessary save/restore of style around list prefix.
Added -hang list support.
-rw-r--r--mdoc_term.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index 7db43e79..8e37cbc1 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -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.
*/