summaryrefslogtreecommitdiffstats
path: root/mdoc_html.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-08-10 14:07:23 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-08-10 14:07:23 +0000
commitffcddd3ed6e06cc3307b16f844664d242efa178f (patch)
tree83209630c170e38a82b4e3935010b26c4cf34f60 /mdoc_html.c
parente393b0f646e06dc74cb0c8a6d9eb2b6665c3fc63 (diff)
downloadmandoc-ffcddd3ed6e06cc3307b16f844664d242efa178f.tar.gz
Allow `Sx' and `Ss' to have child nodes. Fixes manuals in NetBSD.
Originally pointed out by joerg@ then again by Thomas Klausner by way of Nicolas Joy. Note: don't use these constructions as you can't link to the sections with `Sx'.
Diffstat (limited to 'mdoc_html.c')
-rw-r--r--mdoc_html.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/mdoc_html.c b/mdoc_html.c
index 0317a6ad..85322c73 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -608,18 +608,22 @@ mdoc_sh_pre(MDOC_ARGS)
bufinit(h);
bufcat(h, "x");
- for (n = n->child; n; n = n->next) {
+
+ for (n = n->child; n && MDOC_TEXT == n->type; ) {
bufcat_id(h, n->string);
- if (n->next)
+ if (NULL != (n = n->next))
bufcat_id(h, " ");
}
- PAIR_ID_INIT(&tag, h->buf);
- print_otag(h, TAG_H1, 1, &tag);
+ if (NULL == n) {
+ PAIR_ID_INIT(&tag, h->buf);
+ print_otag(h, TAG_H1, 1, &tag);
+ } else
+ print_otag(h, TAG_H1, 0, NULL);
+
return(1);
}
-
/* ARGSUSED */
static int
mdoc_ss_pre(MDOC_ARGS)
@@ -635,14 +639,19 @@ mdoc_ss_pre(MDOC_ARGS)
bufinit(h);
bufcat(h, "x");
- for (n = n->child; n; n = n->next) {
+
+ for (n = n->child; n && MDOC_TEXT == n->type; ) {
bufcat_id(h, n->string);
- if (n->next)
+ if (NULL != (n = n->next))
bufcat_id(h, " ");
}
- PAIR_ID_INIT(&tag, h->buf);
- print_otag(h, TAG_H2, 1, &tag);
+ if (NULL == n) {
+ PAIR_ID_INIT(&tag, h->buf);
+ print_otag(h, TAG_H2, 1, &tag);
+ } else
+ print_otag(h, TAG_H2, 0, NULL);
+
return(1);
}
@@ -1171,9 +1180,10 @@ mdoc_sx_pre(MDOC_ARGS)
bufinit(h);
bufcat(h, "#x");
- for (n = n->child; n; n = n->next) {
+
+ for (n = n->child; n; ) {
bufcat_id(h, n->string);
- if (n->next)
+ if (NULL != (n = n->next))
bufcat_id(h, " ");
}