summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2018-05-08 21:42:12 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2018-05-08 21:42:12 +0000
commit4663bb0548e2f3bcd05adcea0b0f422373cbf0d0 (patch)
tree2683ac04dcc71d2db363db477148544d15199e4a
parent5841f62ce7778f2208ee94b7e3b6162584623636 (diff)
Eliminate the class=It-* attributes.
Cleaner HTML, more idiomatic CSS, and minus 30 lines of C code. Suggested by John Gardner <gardnerjohng at gmail dot com>.
-rw-r--r--usr.bin/mandoc/html.c6
-rw-r--r--usr.bin/mandoc/man_html.c6
-rw-r--r--usr.bin/mandoc/mandoc.css44
-rw-r--r--usr.bin/mandoc/mdoc_html.c67
4 files changed, 47 insertions, 76 deletions
diff --git a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c
index 5a036a07285..bdff1d5b40c 100644
--- a/usr.bin/mandoc/html.c
+++ b/usr.bin/mandoc/html.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: html.c,v 1.93 2018/05/08 17:52:24 schwarze Exp $ */
+/* $OpenBSD: html.c,v 1.94 2018/05/08 21:42:11 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -185,6 +185,10 @@ print_gen_head(struct html *h)
print_endline(h);
print_text(h, "div.Pp { margin: 1ex 0ex; }");
print_endline(h);
+ print_text(h, "dl.Bl-diag ");
+ print_byte(h, '>');
+ print_text(h, " dt { font-weight: bold; }");
+ print_endline(h);
print_text(h, "code.Nm, code.Fl, code.Cm, code.Ic, "
"code.In, code.Fd, code.Fn,");
print_endline(h);
diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c
index 11673267932..c7f7ea123d6 100644
--- a/usr.bin/mandoc/man_html.c
+++ b/usr.bin/mandoc/man_html.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man_html.c,v 1.101 2018/04/24 00:36:04 schwarze Exp $ */
+/* $OpenBSD: man_html.c,v 1.102 2018/05/08 21:42:11 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -523,7 +523,7 @@ man_IP_pre(MAN_ARGS)
const struct roff_node *nn;
if (n->type == ROFFT_BODY) {
- print_otag(h, TAG_DD, "c", "It-tag");
+ print_otag(h, TAG_DD, "");
return 1;
} else if (n->type != ROFFT_HEAD) {
print_otag(h, TAG_DL, "c", "Bl-tag");
@@ -532,7 +532,7 @@ man_IP_pre(MAN_ARGS)
/* FIXME: width specification. */
- print_otag(h, TAG_DT, "c", "It-tag");
+ print_otag(h, TAG_DT, "");
/* For IP, only print the first header element. */
diff --git a/usr.bin/mandoc/mandoc.css b/usr.bin/mandoc/mandoc.css
index ba13134d86d..bc2661cbcde 100644
--- a/usr.bin/mandoc/mandoc.css
+++ b/usr.bin/mandoc/mandoc.css
@@ -1,4 +1,4 @@
-/* $OpenBSD: mandoc.css,v 1.11 2018/05/08 17:52:24 schwarze Exp $ */
+/* $OpenBSD: mandoc.css,v 1.12 2018/05/08 21:42:11 schwarze Exp $ */
/*
* Standard style sheet for mandoc(1) -Thtml and man.cgi(8).
*/
@@ -72,42 +72,49 @@ div.D1 { margin-left: 5ex; }
ul.Bl-bullet { list-style-type: disc;
padding-left: 1em; }
-li.It-bullet { }
+ul.Bl-bullet > li { }
ul.Bl-dash { list-style-type: none;
padding-left: 0em; }
-li.It-dash:before {
+ul.Bl-dash > li:before {
content: "\2014 "; }
ul.Bl-item { list-style-type: none;
padding-left: 0em; }
-li.It-item { }
+ul.Bl-item > li { }
ul.Bl-compact > li {
margin-top: 0ex; }
ol.Bl-enum { padding-left: 2em; }
-li.It-enum { }
+ol.Bl-enum > li { }
ol.Bl-compact > li {
margin-top: 0ex; }
dl.Bl-diag { }
-dt.It-diag { }
-dd.It-diag { margin-left: 0ex; }
-b.It-diag { font-style: normal; }
+dl.Bl-diag > dt {
+ font-style: normal;
+ font-weight: bold; }
+dl.Bl-diag > dd {
+ margin-left: 0ex; }
dl.Bl-hang { }
-dt.It-hang { }
-dd.It-hang { margin-left: 10.2ex; }
+dl.Bl-hang > dt { }
+dl.Bl-hang > dd {
+ margin-left: 10.2ex; }
dl.Bl-inset { }
-dt.It-inset { }
-dd.It-inset { margin-left: 0ex; }
+dl.Bl-inset > dt { }
+dl.Bl-inset > dd {
+ margin-left: 0ex; }
dl.Bl-ohang { }
-dt.It-ohang { }
-dd.It-ohang { margin-left: 0ex; }
+dl.Bl-ohang > dt { }
+dl.Bl-ohang > dd {
+ margin-left: 0ex; }
dl.Bl-tag { margin-left: 10.2ex; }
-dt.It-tag { float: left;
+dl.Bl-tag > dt {
+ float: left;
margin-top: 0ex;
margin-left: -10.2ex;
padding-right: 2ex;
vertical-align: top; }
-dd.It-tag { clear: right;
+dl.Bl-tag > dd {
+ clear: right;
width: 100%;
margin-top: 0ex;
margin-left: 0ex;
@@ -117,8 +124,9 @@ dl.Bl-compact > dt {
margin-top: 0ex; }
table.Bl-column { }
-tr.It-column { }
-td.It-column { margin-top: 1em; }
+table.Bl-column > tbody > tr { }
+table.Bl-column > tbody > tr > td {
+ margin-top: 1em; }
table.Bl-compact > tbody > tr > td {
margin-top: 0ex; }
diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c
index 99ddac9628d..6213548f47c 100644
--- a/usr.bin/mandoc/mdoc_html.c
+++ b/usr.bin/mandoc/mdoc_html.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: mdoc_html.c,v 1.173 2018/05/08 17:52:24 schwarze Exp $ */
+/* $OpenBSD: mdoc_html.c,v 1.174 2018/05/08 21:42:11 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2014,2015,2016,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -666,7 +666,6 @@ mdoc_it_pre(MDOC_ARGS)
{
const struct roff_node *bl;
struct tag *t;
- const char *cattr;
enum mdoc_list type;
bl = n->parent;
@@ -676,42 +675,6 @@ mdoc_it_pre(MDOC_ARGS)
switch (type) {
case LIST_bullet:
- cattr = "It-bullet";
- break;
- case LIST_dash:
- case LIST_hyphen:
- cattr = "It-dash";
- break;
- case LIST_item:
- cattr = "It-item";
- break;
- case LIST_enum:
- cattr = "It-enum";
- break;
- case LIST_diag:
- cattr = "It-diag";
- break;
- case LIST_hang:
- cattr = "It-hang";
- break;
- case LIST_inset:
- cattr = "It-inset";
- break;
- case LIST_ohang:
- cattr = "It-ohang";
- break;
- case LIST_tag:
- cattr = "It-tag";
- break;
- case LIST_column:
- cattr = "It-column";
- break;
- default:
- break;
- }
-
- switch (type) {
- case LIST_bullet:
case LIST_dash:
case LIST_hyphen:
case LIST_item:
@@ -720,7 +683,7 @@ mdoc_it_pre(MDOC_ARGS)
case ROFFT_HEAD:
return 0;
case ROFFT_BODY:
- print_otag(h, TAG_LI, "c", cattr);
+ print_otag(h, TAG_LI, "");
break;
default:
break;
@@ -732,13 +695,10 @@ mdoc_it_pre(MDOC_ARGS)
case LIST_ohang:
switch (n->type) {
case ROFFT_HEAD:
- print_otag(h, TAG_DT, "c", cattr);
- if (type == LIST_diag)
- print_otag(h, TAG_B, "c", cattr);
+ print_otag(h, TAG_DT, "");
break;
case ROFFT_BODY:
- print_otag(h, TAG_DD, "csw*+l", cattr,
- bl->norm->Bl.width);
+ print_otag(h, TAG_DD, "sw*+l", bl->norm->Bl.width);
break;
default:
break;
@@ -751,24 +711,23 @@ mdoc_it_pre(MDOC_ARGS)
(n->parent->prev == NULL ||
n->parent->prev->body == NULL ||
n->parent->prev->body->child != NULL)) {
- t = print_otag(h, TAG_DT, "csw*+-l",
- cattr, bl->norm->Bl.width);
+ t = print_otag(h, TAG_DT, "sw*+-l",
+ bl->norm->Bl.width);
print_text(h, "\\ ");
print_tagq(h, t);
- t = print_otag(h, TAG_DD, "c", cattr);
+ t = print_otag(h, TAG_DD, "");
print_text(h, "\\ ");
print_tagq(h, t);
}
- print_otag(h, TAG_DT, "csw*+-l", cattr,
- bl->norm->Bl.width);
+ print_otag(h, TAG_DT, "sw*+-l", bl->norm->Bl.width);
break;
case ROFFT_BODY:
if (n->child == NULL) {
- print_otag(h, TAG_DD, "css?", cattr,
+ print_otag(h, TAG_DD, "ss?",
"width", "auto");
print_text(h, "\\ ");
} else
- print_otag(h, TAG_DD, "c", cattr);
+ print_otag(h, TAG_DD, "");
break;
default:
break;
@@ -779,10 +738,10 @@ mdoc_it_pre(MDOC_ARGS)
case ROFFT_HEAD:
break;
case ROFFT_BODY:
- print_otag(h, TAG_TD, "c", cattr);
+ print_otag(h, TAG_TD, "");
break;
default:
- print_otag(h, TAG_TR, "c", cattr);
+ print_otag(h, TAG_TR, "");
}
default:
break;