aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_validate.c
diff options
context:
space:
mode:
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 9bb378ef..4e9b2f0e 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.180 2011/12/02 01:37:14 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.181 2011/12/03 16:58:54 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -1826,6 +1826,7 @@ static int
post_sh_head(POST_ARGS)
{
char buf[BUFSIZ];
+ struct mdoc_node *n;
enum mdoc_sec sec;
int c;
@@ -1860,6 +1861,20 @@ post_sh_head(POST_ARGS)
mdoc->lastsec = sec;
+ /*
+ * Set the section attribute for the current HEAD, for its
+ * parent BLOCK, and for the HEAD children; the latter can
+ * only be TEXT nodes, so no recursion is needed.
+ * For other blocks and elements, including .Sh BODY, this is
+ * done when allocating the node data structures, but for .Sh
+ * BLOCK and HEAD, the section is still unknown at that time.
+ */
+
+ mdoc->last->parent->sec = sec;
+ mdoc->last->sec = sec;
+ for (n = mdoc->last->child; n; n = n->next)
+ n->sec = sec;
+
/* We don't care about custom sections after this. */
if (SEC_CUSTOM == sec)