From: "Anthony J. Bentley" <anthony@anjbe.name>
To: tech@mandoc.bsd.lv
Subject: -Thtml: Use hexadecimal character references
Date: Thu, 13 Jul 2017 19:05:36 -0600 [thread overview]
Message-ID: <60588.1499994336@cathet.us> (raw)
Hi,
Since Unicode codepoints are universally referred to in hexadecimal,
this would make the HTML source easier to reason about while debugging.
I have learned many hexadecimal codepoints over the years, but not a
single one in decimal.
The longest character reference, "", is the same length as
"", so numbuf doesn't need to be increased in size.
Index: html.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/html.c,v
retrieving revision 1.85
diff -u -p -r1.85 html.c
--- html.c 23 Jun 2017 02:31:39 -0000 1.85
+++ html.c 13 Jul 2017 16:11:23 -0000
@@ -451,7 +451,7 @@ print_encode(struct html *h, const char
(c > 0x7E && c < 0xA0))
c = 0xFFFD;
if (c > 0x7E) {
- (void)snprintf(numbuf, sizeof(numbuf), "&#%d;", c);
+ (void)snprintf(numbuf, sizeof(numbuf), "&#x%x;", c);
print_word(h, numbuf);
} else if (print_escape(h, c) == 0)
print_byte(h, c);
@@ -514,7 +514,7 @@ print_otag(struct html *h, enum htmltag
print_indent(h);
else if ((h->flags & HTML_NOSPACE) == 0) {
if (h->flags & HTML_KEEP)
- print_word(h, " ");
+ print_word(h, " ");
else {
if (h->flags & HTML_PREKEEP)
h->flags |= HTML_KEEP;
@@ -777,7 +777,7 @@ print_text(struct html *h, const char *w
h->flags |= HTML_KEEP;
print_endword(h);
} else
- print_word(h, " ");
+ print_word(h, " ");
}
assert(NULL == h->metaf);
--
To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv
next reply other threads:[~2017-07-14 1:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-14 1:05 Anthony J. Bentley [this message]
2017-07-14 12:37 ` Ingo Schwarze
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=60588.1499994336@cathet.us \
--to=anthony@anjbe.name \
--cc=tech@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).