source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: Eliminate the class=It-* attributes.
@ 2018-05-08 21:43 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2018-05-08 21:43 UTC (permalink / raw)
  To: source

Log Message:
-----------
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>.

Modified Files:
--------------
    mandoc:
        TODO
        html.c
        man_html.c
        mandoc.css
        mdoc_html.c

Revision Data
-------------
Index: TODO
===================================================================
RCS file: /home/cvs/mandoc/mandoc/TODO,v
retrieving revision 1.252
retrieving revision 1.253
diff -LTODO -LTODO -u -p -r1.252 -r1.253
--- TODO
+++ TODO
@@ -379,12 +379,6 @@ are mere guesses, and some may be wrong.
 
 --- HTML issues --------------------------------------------------------
 
-- replace "li.It-dash:before" with "ul.Bl-dash > li:before"
-  and get rid of the class="It-dash" in the <li>,
-  and similarly for other blocks
-  John Gardner <gardnerjohng at gmail dot com> 23 Apr 2018 13:17:16 +1000
-  loc **  exist **  algo *  size **  imp **
-
 - duplicate names generate duplicate href="#..." anchor attributes
   possibly use "#..._<N>" suffixes?
   Jakub Klinkovsky <j dot l dot k at gmx dot com> 3 Oct 2017 21:23:36 +0200
Index: man_html.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/man_html.c,v
retrieving revision 1.148
retrieving revision 1.149
diff -Lman_html.c -Lman_html.c -u -p -r1.148 -r1.149
--- man_html.c
+++ man_html.c
@@ -525,7 +525,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");
@@ -534,7 +534,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. */
 
Index: mdoc_html.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mdoc_html.c,v
retrieving revision 1.298
retrieving revision 1.299
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.298 -r1.299
--- mdoc_html.c
+++ mdoc_html.c
@@ -1,7 +1,7 @@
 /*	$Id$ */
 /*
  * 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
@@ -668,7 +668,6 @@ mdoc_it_pre(MDOC_ARGS)
 {
 	const struct roff_node	*bl;
 	struct tag		*t;
-	const char		*cattr;
 	enum mdoc_list		 type;
 
 	bl = n->parent;
@@ -678,42 +677,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:
@@ -722,7 +685,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;
@@ -734,13 +697,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;
@@ -753,24 +713,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;
@@ -781,10 +740,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;
Index: mandoc.css
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mandoc.css,v
retrieving revision 1.24
retrieving revision 1.25
diff -Lmandoc.css -Lmandoc.css -u -p -r1.24 -r1.25
--- mandoc.css
+++ mandoc.css
@@ -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; }
 
Index: html.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/html.c,v
retrieving revision 1.223
retrieving revision 1.224
diff -Lhtml.c -Lhtml.c -u -p -r1.223 -r1.224
--- html.c
+++ html.c
@@ -187,6 +187,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);
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-05-08 21:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-08 21:43 mandoc: Eliminate the class=It-* attributes schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).