aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/man.c
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@netbsd.org>2011-11-16 22:39:05 +0000
committerJoerg Sonnenberger <joerg@netbsd.org>2011-11-16 22:39:05 +0000
commitdb509f0bc9a3f8419ae75857a5849111d1e4329d (patch)
tree4ea76e609cbfb26c772fe1b9b1cfe3ac61ec8b0d /man.c
parent739bea9ea92164f148206c8101fd09e4d49413d5 (diff)
downloadmandoc-db509f0bc9a3f8419ae75857a5849111d1e4329d.tar.gz
mandoc-db509f0bc9a3f8419ae75857a5849111d1e4329d.tar.zst
mandoc-db509f0bc9a3f8419ae75857a5849111d1e4329d.zip
Correctly handle constructs like
.TP 8 .SH foo
Diffstat (limited to 'man.c')
-rw-r--r--man.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/man.c b/man.c
index a901c82c..61f2a5eb 100644
--- a/man.c
+++ b/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.113 2011/11/07 01:24:40 schwarze Exp $ */
+/* $Id: man.c,v 1.114 2011/11/16 22:39:05 joerg Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -556,10 +556,15 @@ man_pmacro(struct man *m, int ln, char *buf, int offs)
if ((m->flags & MAN_BLINE) &&
(MAN_BSCOPE & man_macros[tok].flags)) {
n = m->last;
- assert(MAN_TEXT != n->type);
- /* Remove element that didn't end BLINE, if any. */
+ /* Might be a text node like 8 in
+ * .TP 8
+ * .SH foo
+ */
+ if (MAN_TEXT == n->type)
+ n = n->parent;
+ /* Remove element that didn't end BLINE, if any. */
if ( ! (MAN_BSCOPE & man_macros[n->tok].flags))
n = n->parent;