From 3d6e9a7c90ab50efceef698fea21419cca924cb1 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 9 Aug 2009 17:38:25 +0000 Subject: sync to 1.8.2: more .Bl -column fixes, in particular: 1) -column implies -compact 2) do not die from fewer columns than specified (more are still fatal) --- usr.bin/mandoc/mdoc_term.c | 12 ++++++++++-- usr.bin/mandoc/mdoc_validate.c | 19 ++++++++++++++----- 2 files changed, 24 insertions(+), 7 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index 2b25ad15c29..d733554a334 100644 --- a/usr.bin/mandoc/mdoc_term.c +++ b/usr.bin/mandoc/mdoc_term.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.40 2009/07/26 23:39:54 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.41 2009/08/09 17:38:24 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -667,6 +667,9 @@ fmt_block_vspace(struct termp *p, if (arg_hasattr(MDOC_Compact, bl)) return(1); + /* XXX - not documented! */ + else if (arg_hasattr(MDOC_Column, bl)) + return(1); for (n = node; n; n = n->parent) { if (MDOC_BLOCK != n->type) @@ -790,6 +793,8 @@ termp_it_pre(DECL_ARGS) if (0 == width) width = 8; break; + case (MDOC_Column): + /* FALLTHROUGH */ case (MDOC_Tag): if (0 == width) width = 10; @@ -908,12 +913,14 @@ termp_it_pre(DECL_ARGS) case (MDOC_Hang): /* FALLTHROUGH */ case (MDOC_Tag): + assert(width); if (MDOC_HEAD == node->type) p->rmargin = p->offset + width; else p->offset += width; break; case (MDOC_Column): + assert(width); p->rmargin = p->offset + width; break; default: @@ -1813,8 +1820,9 @@ static void termp_in_post(DECL_ARGS) { - p->flags |= TERMP_NOSPACE; + p->flags |= TERMP_NOSPACE | ttypes[TTYPE_INCLUDE]; term_word(p, ">"); + p->flags &= ~ttypes[TTYPE_INCLUDE]; if (SEC_SYNOPSIS != node->sec) return; diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c index cd0f3237df2..27d553cdfeb 100644 --- a/usr.bin/mandoc/mdoc_validate.c +++ b/usr.bin/mandoc/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.31 2009/07/26 01:59:46 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.32 2009/08/09 17:38:24 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -1024,11 +1024,20 @@ post_it(POST_ARGS) c = mdoc->last->child; for (i = 0; c && MDOC_HEAD == c->type; c = c->next) i++; - if (i == cols) + + if (i < cols) { + if ( ! mdoc_vwarn(mdoc, mdoc->last->line, + mdoc->last->pos, "column " + "mismatch: have %d, want %d", + i, cols)) + return(0); break; - return(mdoc_verr(mdoc, mdoc->last->line, mdoc->last->pos, - "column mismatch (have %d, want %d)", - i, cols)); + } else if (i == cols) + break; + + return(mdoc_verr(mdoc, mdoc->last->line, + mdoc->last->pos, "column mismatch: " + "have %d, want %d", i, cols)); default: break; } -- cgit v1.2.3