diff options
-rw-r--r-- | usr.bin/mandoc/cgi.c | 4 | ||||
-rw-r--r-- | usr.bin/mandoc/html.c | 5 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_html.c | 50 |
3 files changed, 53 insertions, 6 deletions
diff --git a/usr.bin/mandoc/cgi.c b/usr.bin/mandoc/cgi.c index 7d52dcc1204..c8a9ee7ac58 100644 --- a/usr.bin/mandoc/cgi.c +++ b/usr.bin/mandoc/cgi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgi.c,v 1.83 2017/01/21 01:20:29 schwarze Exp $ */ +/* $OpenBSD: cgi.c,v 1.84 2017/01/25 02:14:41 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@usta.de> @@ -797,6 +797,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 ? "/" : ""); @@ -824,6 +825,7 @@ resp_format(const struct req *req, const char *file) mparse_free(mp); mchars_free(); free(conf.man); + free(conf.style); } static void diff --git a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c index c4694f6a5cd..d9eb9ce25e7 100644 --- a/usr.bin/mandoc/html.c +++ b/usr.bin/mandoc/html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: html.c,v 1.70 2017/01/21 02:28:42 schwarze Exp $ */ +/* $OpenBSD: html.c,v 1.71 2017/01/25 02:14:41 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011-2015, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -564,8 +564,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(); diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c index 54bd26a4633..5e0b986c3fd 100644 --- a/usr.bin/mandoc/mdoc_html.c +++ b/usr.bin/mandoc/mdoc_html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_html.c,v 1.135 2017/01/21 02:09:49 schwarze Exp $ */ +/* $OpenBSD: mdoc_html.c,v 1.136 2017/01/25 02:14:41 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -669,6 +669,7 @@ static int mdoc_it_pre(MDOC_ARGS) { const struct roff_node *bl; + struct tag *t; const char *cattr; enum mdoc_list type; @@ -736,7 +737,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) @@ -757,6 +757,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: @@ -843,9 +878,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"; |