aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-07-13 07:23:07 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-07-13 07:23:07 +0000
commit3196b9ca19498a6d0ca78bb7cdedcb804a86338a (patch)
tree23f70925cf9081757646ce851140fda5b9b642e9 /mdoc_term.c
parentdad3c2117152071099f857651e99f8673aa988dd (diff)
downloadmandoc-3196b9ca19498a6d0ca78bb7cdedcb804a86338a.tar.gz
mandoc-3196b9ca19498a6d0ca78bb7cdedcb804a86338a.tar.zst
mandoc-3196b9ca19498a6d0ca78bb7cdedcb804a86338a.zip
Err/warn fix (schwarze@openbsd.org).
Lots of whitespace churn in getting functions aligned nicely.
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index 208dc94c..08ae01d4 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.37 2009/07/12 20:50:08 kristaps Exp $ */
+/* $Id: mdoc_term.c,v 1.38 2009/07/13 07:23:07 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -571,16 +571,15 @@ arg_listtype(const struct mdoc_node *n)
/* FALLTHROUGH */
case (MDOC_Column):
/* FALLTHROUGH */
+ case (MDOC_Hang):
+ /* FALLTHROUGH */
case (MDOC_Ohang):
return(n->args->argv[i].arg);
default:
break;
}
- /* FIXME: mandated by parser. */
-
- errx(1, "list type not supported");
- /* NOTREACHED */
+ return(-1);
}
@@ -726,6 +725,7 @@ termp_it_pre(DECL_ARGS)
(void)arg_getattrs(keys, vals, 3, bl);
type = arg_listtype(bl);
+ assert(-1 != type);
/* Calculate real width and offset. */
@@ -752,7 +752,7 @@ termp_it_pre(DECL_ARGS)
/*
* List-type can override the width in the case of fixed-head
* values (bullet, dash/hyphen, enum). Tags need a non-zero
- * offset.
+ * offset. FIXME: double-check that correct.
*/
switch (type) {
@@ -768,6 +768,8 @@ termp_it_pre(DECL_ARGS)
if (width < 5)
width = 5;
break;
+ case (MDOC_Hang):
+ /* FALLTHROUGH */
case (MDOC_Tag):
if (0 == width)
width = 10;
@@ -785,6 +787,8 @@ 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;
@@ -826,11 +830,17 @@ termp_it_pre(DECL_ARGS)
/* FALLTHROUGH */
case (MDOC_Hyphen):
/* FALLTHROUGH */
+ 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 && MDOC_Tag == type)
if (NULL == node->next ||
NULL == node->next->child)
@@ -872,6 +882,8 @@ termp_it_pre(DECL_ARGS)
/* FALLTHROUGH */
case (MDOC_Hyphen):
/* FALLTHROUGH */
+ case (MDOC_Hang):
+ /* FALLTHROUGH */
case (MDOC_Tag):
if (MDOC_HEAD == node->type)
p->rmargin = p->offset + width;
@@ -954,6 +966,7 @@ termp_it_post(DECL_ARGS)
return;
type = arg_listtype(node->parent->parent->parent);
+ assert(-1 != type);
switch (type) {
case (MDOC_Diag):