* mandoc: In HTML output, correctly render .Bd -unfilled in
@ 2021-03-30 19:26 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2021-03-30 19:26 UTC (permalink / raw)
To: source
Log Message:
-----------
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.
Modified Files:
--------------
mandoc:
mandoc.css
mdoc_html.c
mandoc/regress/mdoc/Bd:
paragraph.out_html
Revision Data
-------------
Index: mandoc.css
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mandoc.css,v
retrieving revision 1.47
retrieving revision 1.48
diff -Lmandoc.css -Lmandoc.css -u -p -r1.47 -r1.48
--- mandoc.css
+++ mandoc.css
@@ -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;
Index: mdoc_html.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mdoc_html.c,v
retrieving revision 1.341
retrieving revision 1.342
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.341 -r1.342
--- mdoc_html.c
+++ mdoc_html.c
@@ -1,6 +1,6 @@
/* $Id$ */
/*
- * 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;
@@ -966,6 +966,9 @@ mdoc_bd_pre(MDOC_ARGS)
if (n->norm->Bd.offs != NULL &&
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;
Index: paragraph.out_html
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Bd/paragraph.out_html,v
retrieving revision 1.6
retrieving revision 1.7
diff -Lregress/mdoc/Bd/paragraph.out_html -Lregress/mdoc/Bd/paragraph.out_html -u -p -r1.6 -r1.7
--- regress/mdoc/Bd/paragraph.out_html
+++ 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>
--
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:[~2021-03-30 19:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-30 19:26 mandoc: In HTML output, correctly render .Bd -unfilled in 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).