diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2009-08-09 20:37:33 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2009-08-09 20:37:33 +0000 |
commit | 4cfb83e44b5cf8abc8feac6b24dcbecd098f4912 (patch) | |
tree | 5c4740aab9c27f886939a0b7ae5318b13a5a64ae /usr.bin/mandoc | |
parent | 00ed39a99e062bcc27f2c8fc87b9d3600113e079 (diff) |
sync to 1.8.3: ugly fix for .Bl or .Bd when nested in .Bl -hang
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r-- | usr.bin/mandoc/mdoc_term.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index 6d21416f19c..06489716d0f 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.46 2009/08/09 20:11:30 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.47 2009/08/09 20:37:32 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -27,7 +27,6 @@ #include "mdoc.h" /* FIXME: macro arguments can be escaped. */ -/* FIXME: support more offset/width tokens. */ #define TTYPE_PROG 0 #define TTYPE_CMD_FLAG 1 @@ -66,7 +65,7 @@ const int ttypes[TTYPE_NMAX] = { TERMP_UNDER, /* TTYPE_FUNC_ARG */ TERMP_UNDER, /* TTYPE_LINK */ TERMP_BOLD, /* TTYPE_SSECTION */ - TERMP_UNDER, /* TTYPE_FILE */ + TERMP_UNDER, /* TTYPE_FILE */ TERMP_UNDER, /* TTYPE_EMPH */ TERMP_BOLD, /* TTYPE_CONFIG */ TERMP_BOLD, /* TTYPE_CMD */ @@ -903,7 +902,21 @@ termp_it_pre(DECL_ARGS) else p->flags |= TERMP_NOLPAD; - if (MDOC_HEAD == node->type) + if (MDOC_HEAD != node->type) + break; + + /* + * This is ugly. If `-hang' is specified and the body + * is a `Bl' or `Bd', then we want basically to nullify + * the "overstep" effect in term_flushln() and treat + * this as a `-ohang' list instead. + */ + if (node->next->child && + (MDOC_Bl == node->next->child->tok || + MDOC_Bd == node->next->child->tok)) { + p->flags &= ~TERMP_NOBREAK; + p->flags &= ~TERMP_NOLPAD; + } else p->flags |= TERMP_HANG; break; case (MDOC_Tag): @@ -945,6 +958,17 @@ termp_it_pre(DECL_ARGS) p->offset += offset; switch (type) { + case (MDOC_Hang): + /* + * Same stipulation as above, regarding `-hang'. We + * don't want to recalculate rmargin and offsets when + * using `Bd' or `Bl' within `-hang' overstep lists. + */ + if (MDOC_HEAD == node->type && node->next->child && + (MDOC_Bl == node->next->child->tok || + MDOC_Bd == node->next->child->tok)) + break; + /* FALLTHROUGH */ case (MDOC_Bullet): /* FALLTHROUGH */ case (MDOC_Dash): @@ -953,8 +977,6 @@ termp_it_pre(DECL_ARGS) /* FALLTHROUGH */ case (MDOC_Hyphen): /* FALLTHROUGH */ - case (MDOC_Hang): - /* FALLTHROUGH */ case (MDOC_Tag): assert(width); if (MDOC_HEAD == node->type) |