aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_html.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-09-26 18:31:36 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-09-26 18:31:36 +0000
commit7f3ccbb92297395ea62b5fc049bfdb1a50a6bd31 (patch)
tree14444dc0baafda859f6c21215ac53dfa8956668b /mdoc_html.c
parent2ff1987dc7da1fe54d433d1c86d811b67ff297c0 (diff)
downloadmandoc-7f3ccbb92297395ea62b5fc049bfdb1a50a6bd31.tar.gz
mandoc-7f3ccbb92297395ea62b5fc049bfdb1a50a6bd31.tar.zst
mandoc-7f3ccbb92297395ea62b5fc049bfdb1a50a6bd31.zip
SYNOPSIS functions in -Thtml text-indent and group paramters (as nroff does).
Diffstat (limited to 'mdoc_html.c')
-rw-r--r--mdoc_html.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/mdoc_html.c b/mdoc_html.c
index 51abad2d..83ea88b3 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.14 2009/09/26 18:02:51 kristaps Exp $ */
+/* $Id: mdoc_html.c,v 1.15 2009/09/26 18:31:36 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -1603,26 +1603,27 @@ static int
mdoc_fn_pre(MDOC_ARGS)
{
struct tag *t;
- struct htmlpair tag;
+ struct htmlpair tag[2];
const struct mdoc_node *nn;
char nbuf[BUFSIZ];
const char *sp, *ep;
- int sz;
+ int sz, i;
if (SEC_SYNOPSIS == n->sec) {
- if (n->next) {
- tag.key = ATTR_STYLE;
- tag.val = "margin-bottom: 1em";
- print_otag(h, TAG_DIV, 1, &tag);
- } else
- print_otag(h, TAG_DIV, 0, NULL);
+ bufcat("margin-left: 6em;");
+ bufcat("text-indent: -6em;");
+ if (n->next)
+ bufcat("margin-bottom: 1em;");
+ tag[0].key = ATTR_STYLE;
+ tag[0].val = buf;
+ print_otag(h, TAG_DIV, 1, tag);
}
/* Split apart into type and name. */
- tag.key = ATTR_CLASS;
- tag.val = "ftype";
- t = print_otag(h, TAG_SPAN, 1, &tag);
+ tag[0].key = ATTR_CLASS;
+ tag[0].val = "ftype";
+ t = print_otag(h, TAG_SPAN, 1, tag);
assert(n->child->string);
sp = n->child->string;
@@ -1636,9 +1637,9 @@ mdoc_fn_pre(MDOC_ARGS)
print_tagq(h, t);
- tag.key = ATTR_CLASS;
- tag.val = "fname";
- t = print_otag(h, TAG_SPAN, 1, &tag);
+ tag[0].key = ATTR_CLASS;
+ tag[0].val = "fname";
+ t = print_otag(h, TAG_SPAN, 1, tag);
if (sp) {
(void)strlcpy(nbuf, sp, BUFSIZ);
@@ -1651,9 +1652,15 @@ mdoc_fn_pre(MDOC_ARGS)
print_text(h, "(");
for (nn = n->child->next; nn; nn = nn->next) {
- tag.key = ATTR_CLASS;
- tag.val = "farg";
- t = print_otag(h, TAG_SPAN, 1, &tag);
+ i = 0;
+ tag[i].key = ATTR_CLASS;
+ tag[i++].val = "farg";
+ if (SEC_SYNOPSIS == n->sec) {
+ tag[i].key = ATTR_STYLE;
+ tag[i++].val = "white-space: nowrap;";
+ }
+
+ t = print_otag(h, TAG_SPAN, i, tag);
print_text(h, nn->string);
print_tagq(h, t);
if (nn->next)