From 861f9666a8c6cb002b94daafc3e04265d90c60db Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Tue, 30 Mar 2021 19:26:20 +0000 Subject: In HTML output, correctly render .Bd -unfilled in proportionally-spaced font, rather than with the monospace font appropriate for .Bd -literal. This fixes a minibug reported by anton@. Implemented by no longer relying on the typical browser default of "pre { font-family: monospace }" but instead letting
 elements
inherit the font family from their parent, then adding an explicit CSS .Li
class only for those displays where the manual page author requested it
by using the -literal option on the .Bd macro.
---
 mandoc.css                         | 3 ++-
 mdoc_html.c                        | 9 ++++++---
 regress/mdoc/Bd/paragraph.out_html | 2 +-
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/mandoc.css b/mandoc.css
index 6ad33514..ceac503a 100644
--- a/mandoc.css
+++ b/mandoc.css
@@ -1,4 +1,4 @@
-/* $Id: mandoc.css,v 1.47 2020/10/30 21:34:30 schwarze Exp $ */
+/* $Id: mandoc.css,v 1.48 2021/03/30 19:26:20 schwarze Exp $ */
 /*
  * Standard style sheet for mandoc(1) -Thtml and man.cgi(8).
  *
@@ -31,6 +31,7 @@ td {		vertical-align: top;
 ul, ol, dl {	margin-top: 0em;
 		margin-bottom: 0em; }
 li, dt {	margin-top: 1em; }
+pre {		font-family: inherit; }
 
 .permalink {	border-bottom: thin dotted;
 		color: inherit;
diff --git a/mdoc_html.c b/mdoc_html.c
index 0569255b..c0a0a6a5 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,6 +1,6 @@
-/* $Id: mdoc_html.c,v 1.341 2020/10/16 17:22:43 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.342 2021/03/30 19:26:20 schwarze Exp $ */
 /*
- * Copyright (c) 2014-2020 Ingo Schwarze 
+ * Copyright (c) 2014-2021 Ingo Schwarze 
  * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons 
  *
  * Permission to use, copy, modify, and distribute this software for any
@@ -930,7 +930,7 @@ mdoc_sx_pre(MDOC_ARGS)
 static int
 mdoc_bd_pre(MDOC_ARGS)
 {
-	char			 buf[16];
+	char			 buf[20];
 	struct roff_node	*nn;
 	int			 comp;
 
@@ -967,6 +967,9 @@ mdoc_bd_pre(MDOC_ARGS)
 	    strcmp(n->norm->Bd.offs, "left") != 0)
 		(void)strlcat(buf, " Bd-indent", sizeof(buf));
 
+	if (n->norm->Bd.type == DISP_literal)
+		(void)strlcat(buf, " Li", sizeof(buf));
+
 	print_otag_id(h, TAG_DIV, buf, n);
 	return 1;
 }
diff --git a/regress/mdoc/Bd/paragraph.out_html b/regress/mdoc/Bd/paragraph.out_html
index 22355ed1..df5fc6d6 100644
--- a/regress/mdoc/Bd/paragraph.out_html
+++ b/regress/mdoc/Bd/paragraph.out_html
@@ -7,7 +7,7 @@
 
 back to normal
 

another paragraph

-
+
 literal
 display
 
-- 
cgit v1.2.3-56-ge451