summaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_html.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-09-24 11:55:28 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-09-24 11:55:28 +0000
commite29162affa9ae847d5a3511c2945c9b3fff13597 (patch)
treec40c0364b3b2ff22f998f2ccbd15ae1988183ef8 /mdoc_html.c
parent5827a70535876bf8f6a58191951c114f0c56b47d (diff)
downloadmandoc-e29162affa9ae847d5a3511c2945c9b3fff13597.tar.gz
mandoc-e29162affa9ae847d5a3511c2945c9b3fff13597.tar.zst
mandoc-e29162affa9ae847d5a3511c2945c9b3fff13597.zip
Fix in -Tascii where `Lb' causes line-break in any section (should only happen in LIBRARY).
`Fn' first parameter is broken apart into ftype and fname in -Thtml (for correct style application). Fixed \0 special character.
Diffstat (limited to 'mdoc_html.c')
-rw-r--r--mdoc_html.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/mdoc_html.c b/mdoc_html.c
index 03c3c504..ade7d89b 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.6 2009/09/24 11:05:45 kristaps Exp $ */
+/* $Id: mdoc_html.c,v 1.7 2009/09/24 11:55:28 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -15,6 +15,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/types.h>
+#include <sys/param.h>
#include <sys/queue.h>
#include <assert.h>
@@ -1560,7 +1561,7 @@ mdoc_ft_pre(MDOC_ARGS)
}
tag.key = ATTR_CLASS;
- tag.val = "type";
+ tag.val = "ftype";
print_otag(h, TAG_SPAN, 1, &tag);
return(1);
}
@@ -1573,6 +1574,9 @@ mdoc_fn_pre(MDOC_ARGS)
struct tag *t;
struct htmlpair tag;
const struct mdoc_node *nn;
+ char nbuf[BUFSIZ];
+ const char *sp, *ep;
+ int sz;
if (SEC_SYNOPSIS == n->sec) {
if (n->next) {
@@ -1583,13 +1587,33 @@ mdoc_fn_pre(MDOC_ARGS)
print_otag(h, TAG_DIV, 0, NULL);
}
+ /* Split apart into type and name. */
+
tag.key = ATTR_CLASS;
- tag.val = "type";
+ tag.val = "ftype";
+ t = print_otag(h, TAG_SPAN, 1, &tag);
+
+ assert(n->child->string);
+ sp = n->child->string;
+ while ((ep = strchr(sp, ' '))) {
+ sz = MIN(ep - sp, BUFSIZ - 1);
+ (void)memcpy(nbuf, sp, sz);
+ nbuf[sz] = '\0';
+ print_text(h, nbuf);
+ sp = ++ep;
+ }
- /* FIXME: can be "type funcname" "type varname"... */
+ print_tagq(h, t);
+ tag.key = ATTR_CLASS;
+ tag.val = "fname";
t = print_otag(h, TAG_SPAN, 1, &tag);
- print_text(h, n->child->string);
+
+ if (sp) {
+ (void)strlcpy(nbuf, sp, BUFSIZ);
+ print_text(h, nbuf);
+ }
+
print_tagq(h, t);
h->flags |= HTML_NOSPACE;