diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-09-24 11:55:28 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-09-24 11:55:28 +0000 |
commit | 0371d94639d271317d0697e7eefe5cb79df85fb7 (patch) | |
tree | d585e0c9978240817fc4183c33d9deff2ac20086 /mdoc_html.c | |
parent | f31eee34a29f6fcdb8fe0640095473ede5982887 (diff) | |
download | mandoc-0371d94639d271317d0697e7eefe5cb79df85fb7.tar.gz |
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.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/mdoc_html.c b/mdoc_html.c index e7f1abe2..2d93cca1 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -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; |