shithub: rgbds

Download patch

ref: 3c304f3acf5ff914ec3b1c8faacbc4c39c32ef36
parent: e308130e23d56fbc51c1eba7d964299d83108765
author: ISSOtm <[email protected]>
date: Tue Mar 24 06:18:38 EDT 2020

Override mandoc styling without modifying the stylesheet

--- a/docs/mandoc.css
+++ b/docs/mandoc.css
@@ -10,10 +10,7 @@
 
 /* Global defaults. */
 
-/* This is handled in `rgbds.css` instead
- *
- * html {		max-width: 65em; }
- */
+html {		max-width: 65em; }
 body {		font-family: Helvetica,Arial,sans-serif; }
 table {		margin-top: 0em;
 		margin-bottom: 0em;
--- a/docs/rgbds.css
+++ b/docs/rgbds.css
@@ -4,18 +4,21 @@
 	/* Reduce contrast */
 	background-color: #f8f8f8;
 	color: #222;
+
+	/* Override `mandoc.css`'s sowe can put it on <body> instead */
+	max-width: none;
 }
 
 body {
-	/* Improve readability */
-	font-size: 16px;
-	line-height: 1.4;
-	text-align: justify;
-
 	/* Center body horizontally (requires <html> to span full width) */
 	margin: 0 auto;
 	/* `mandoc.css`'s default, but it's applied to <html> there */
 	max-width: 65em;
+
+	/* Improve readability */
+	font-size: 16px;
+	line-height: 1.4;
+	text-align: justify;
 }
 @media print {
 	body {
--- a/src/doc_postproc.awk
+++ b/src/doc_postproc.awk
@@ -1,10 +1,5 @@
 #!/usr/bin/awk -f
 
-/<link/ {
-	# Inject our own style overrides
-	print("  <link rel=\"stylesheet\" href=\"rgbds.css\" type=\"text/css\" media=\"all\"/>")
-}
-
 /^\s+<td><b class="Sy">.+<\/b><\/td>$/ {
 	# Assuming that all cells whose contents are bold are heading cells,
 	# use the HTML tag for those
@@ -82,4 +77,9 @@
 /<head>/ {
 	# Add viewport size <meta> tag for mobile users
 	print "  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">"
+}
+
+/<link/ {
+	# Inject our own style overrides
+	print("  <link rel=\"stylesheet\" href=\"rgbds.css\" type=\"text/css\" media=\"all\"/>")
 }