diff options
-rw-r--r-- | TODO | 6 | ||||
-rw-r--r-- | cgi.c | 2 | ||||
-rw-r--r-- | html.c | 3 | ||||
-rw-r--r-- | mandoc.css | 15 | ||||
-rw-r--r-- | mandoc_html.3 | 4 | ||||
-rw-r--r-- | mdoc_html.c | 48 |
6 files changed, 66 insertions, 12 deletions
@@ -408,12 +408,6 @@ are mere guesses, and some may be wrong. --- HTML issues -------------------------------------------------------- -- <dl><dt><dd> formatting is ugly - hints are easy to find on the web, e.g. - http://stackoverflow.com/questions/1713048/ - see also matthew@ Fri, 18 Jul 2014 19:25:12 -0700 - loc * exist * algo ** size * imp *** - - In -man -Thtml, .nf does not preserve indentation. It should either convert blanks to or use <pre> rather than <div> (like .Bd -literal does). @@ -799,6 +799,7 @@ resp_format(const struct req *req, const char *file) memset(&conf, 0, sizeof(conf)); conf.fragment = 1; + conf.style = mandoc_strdup(CSS_DIR "/mandoc.css"); usepath = strcmp(req->q.manpath, req->p[0]); mandoc_asprintf(&conf.man, "/%s%s%%N.%%S", usepath ? req->q.manpath : "", usepath ? "/" : ""); @@ -826,6 +827,7 @@ resp_format(const struct req *req, const char *file) mparse_free(mp); mchars_free(); free(conf.man); + free(conf.style); } static void @@ -566,8 +566,11 @@ print_otag(struct html *h, enum htmltag tag, const char *fmt, ...) SCALE_VS_INIT(su, i); break; case 'w': + case 'W': s = va_arg(ap, char *); a2width(s, su); + if (fmt[-1] == 'W') + su->scale *= -1.0; break; default: abort(); @@ -91,9 +91,18 @@ dd.It-inset { } dl.Bl-ohang { } dt.It-ohang { } dd.It-ohang { margin-left: 0ex; } -dl.Bl-tag { } -dt.It-tag { } -dd.It-tag { } +dl.Bl-tag { margin-left: 8ex; } +dt.It-tag { float: left; + clear: both; + margin-top: 0ex; + margin-left: -8ex; + padding-right: 2ex; + vertical-align: top; } +dd.It-tag { width: 100%; + margin-top: 0ex; + margin-left: 0ex; + vertical-align: top; + overflow: auto; } table.Bl-column { } tr.It-column { } diff --git a/mandoc_html.3 b/mandoc_html.3 index 517b0eff..1ec5637b 100644 --- a/mandoc_html.3 +++ b/mandoc_html.3 @@ -212,6 +212,10 @@ Requires one argument, interpreted as an .Xr mdoc 7 Ns -style width specifier. +.It Cm W +Similar to +.Cm w , +but makes the width negative by multiplying it with \(mi1. .El .Pp Style name letters decide what to do with the preceding argument: diff --git a/mdoc_html.c b/mdoc_html.c index a09f2f42..e5ac0a2c 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -671,6 +671,7 @@ static int mdoc_it_pre(MDOC_ARGS) { const struct roff_node *bl; + struct tag *t; const char *cattr; enum mdoc_list type; @@ -738,7 +739,6 @@ mdoc_it_pre(MDOC_ARGS) case LIST_hang: case LIST_inset: case LIST_ohang: - case LIST_tag: switch (n->type) { case ROFFT_HEAD: if (bl->norm->Bl.comp) @@ -759,6 +759,41 @@ mdoc_it_pre(MDOC_ARGS) break; } break; + case LIST_tag: + switch (n->type) { + case ROFFT_HEAD: + if (h->style != NULL && !bl->norm->Bl.comp && + (n->parent->prev == NULL || + n->parent->prev->body->child != NULL)) { + if (bl->norm->Bl.width == NULL) + t = print_otag(h, TAG_DT, "c", cattr); + else + t = print_otag(h, TAG_DT, "csWl", + cattr, bl->norm->Bl.width); + print_text(h, "\\ "); + print_tagq(h, t); + t = print_otag(h, TAG_DD, "c", cattr); + print_text(h, "\\ "); + print_tagq(h, t); + } + if (bl->norm->Bl.width == NULL) + print_otag(h, TAG_DT, "c", cattr); + else + print_otag(h, TAG_DT, "csWl", cattr, + bl->norm->Bl.width); + break; + case ROFFT_BODY: + if (n->child == NULL) { + print_otag(h, TAG_DD, "css?", cattr, + "width", "auto"); + print_text(h, "\\ "); + } else + print_otag(h, TAG_DD, "c", cattr); + break; + default: + break; + } + break; case LIST_column: switch (n->type) { case ROFFT_HEAD: @@ -845,9 +880,16 @@ mdoc_bl_pre(MDOC_ARGS) cattr = "Bl-ohang"; break; case LIST_tag: - elemtype = TAG_DL; cattr = "Bl-tag"; - break; + if (n->norm->Bl.offs) + print_otag(h, TAG_DIV, "cswl", cattr, + n->norm->Bl.offs); + if (n->norm->Bl.width == NULL) + print_otag(h, TAG_DL, "c", cattr); + else + print_otag(h, TAG_DL, "cswl", cattr, + n->norm->Bl.width); + return 1; case LIST_column: elemtype = TAG_TABLE; cattr = "Bl-column"; |