aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2021-03-30 19:26:20 +0000
committerIngo Schwarze <schwarze@openbsd.org>2021-03-30 19:26:20 +0000
commit861f9666a8c6cb002b94daafc3e04265d90c60db (patch)
tree8a7db4f7dfe780a0c7282c78025e812c04af0dcd
parent6e220064abb2f2f7e5756999097a6db9c2064787 (diff)
downloadmandoc-861f9666a8c6cb002b94daafc3e04265d90c60db.tar.gz
mandoc-861f9666a8c6cb002b94daafc3e04265d90c60db.tar.zst
mandoc-861f9666a8c6cb002b94daafc3e04265d90c60db.zip
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 <pre> 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.
-rw-r--r--mandoc.css3
-rw-r--r--mdoc_html.c9
-rw-r--r--regress/mdoc/Bd/paragraph.out_html2
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 <schwarze@openbsd.org>
+ * Copyright (c) 2014-2021 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
*
* 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 @@
</div>
back to normal
<p class="Pp">another paragraph</p>
-<div class="Bd Pp" id="unfilled">
+<div class="Bd Pp Li" id="unfilled">
<pre><a class="permalink" href="#unfilled">unfilled</a> literal
display
<mark id="upara"></mark>