From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: In HTML output, correctly render .Bd -unfilled in
Date: Tue, 30 Mar 2021 14:26:23 -0500 (EST) [thread overview]
Message-ID: <c2a8981c398067b1@mandoc.bsd.lv> (raw)
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
reply other threads:[~2021-03-30 19:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c2a8981c398067b1@mandoc.bsd.lv \
--to=schwarze@mandoc.bsd.lv \
--cc=source@mandoc.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).