summaryrefslogtreecommitdiffstatshomepage
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
commitc619517840844d90275e85e95a4c4721398bf1a1 (patch)
tree6824e940ac83fd35ae554f4538237ec126295e29 /mdoc_html.c
parentf69e01302697e376e379e332951a82596c22d73d (diff)
downloadmandoc-c619517840844d90275e85e95a4c4721398bf1a1.tar.gz
mandoc-c619517840844d90275e85e95a4c4721398bf1a1.tar.zst
mandoc-c619517840844d90275e85e95a4c4721398bf1a1.zip
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.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/mdoc_html.c b/mdoc_html.c
index 51d31e4b..9f6e42be 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.174 2011/07/23 22:57:13 kristaps Exp $ */
+/* $Id: mdoc_html.c,v 1.175 2011/08/10 14:07:23 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -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, " ");
}