=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mdoc_term.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- src/usr.bin/mandoc/mdoc_term.c 2009/07/18 19:44:38 1.32 +++ src/usr.bin/mandoc/mdoc_term.c 2009/07/18 20:50:38 1.33 @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.32 2009/07/18 19:44:38 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.33 2009/07/18 20:50:38 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -567,16 +567,15 @@ /* 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); } @@ -722,6 +721,7 @@ (void)arg_getattrs(keys, vals, 3, bl); type = arg_listtype(bl); + assert(-1 != type); /* Calculate real width and offset. */ @@ -748,7 +748,7 @@ /* * 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) { @@ -764,6 +764,10 @@ if (width < 5) width = 5; break; + case (MDOC_Hang): + if (0 == width) + width = 8; + break; case (MDOC_Tag): if (0 == width) width = 10; @@ -821,16 +825,30 @@ 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): + if (MDOC_HEAD == node->type) + p->flags |= TERMP_NOBREAK; + else + p->flags |= TERMP_NOLPAD; + + 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) { @@ -868,6 +886,8 @@ /* FALLTHROUGH */ case (MDOC_Hyphen): /* FALLTHROUGH */ + case (MDOC_Hang): + /* FALLTHROUGH */ case (MDOC_Tag): if (MDOC_HEAD == node->type) p->rmargin = p->offset + width; @@ -947,6 +967,7 @@ return; type = arg_listtype(node->parent->parent->parent); + assert(-1 != type); switch (type) { case (MDOC_Diag):