From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: Trivial patch to put the roff(7) \g (interpolate format of
Date: Tue, 31 May 2022 13:10:28 -0500 (EST) [thread overview]
Message-ID: <336596d87b415673@mandoc.bsd.lv> (raw)
Log Message:
-----------
Trivial patch to put the roff(7) \g (interpolate format of register)
escape sequence into the correct parsing class, ESCAPE_EXPAND.
Expansion of \g is supposed to work exactly like the expansion
of the related escape sequence \n (interpolate register value),
but since we ignore the .af (assign output format) request,
we just interpolate an empty string to replace the \g sequence.
Surprising as it may seem, this actually makes a formatting difference
for deviate input like ".O\gNx" which used to raise bogus "escaped
character not allowed in a name" and "skipping unknown macro" errors
and printed nothing, whereas now it correctly prints "OpenBSD".
Modified Files:
--------------
mandoc:
roff.c
roff_escape.c
roff.7
Revision Data
-------------
Index: roff.7
===================================================================
RCS file: /home/cvs/mandoc/mandoc/roff.7,v
retrieving revision 1.118
retrieving revision 1.119
diff -Lroff.7 -Lroff.7 -u -p -r1.118 -r1.119
--- roff.7
+++ roff.7
@@ -2085,7 +2085,8 @@ defaults to
.Ic \efP .
.It Ic \eg[ Ns Ar name Ns Ic \&]
Interpolate the format of a number register; ignored by
-.Xr mandoc 1 .
+.Xr mandoc 1 ,
+which interpolates an empty string instead.
For short names, there are variants
.Ic \eg Ns Ar c
and
Index: roff_escape.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/roff_escape.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lroff_escape.c -Lroff_escape.c -u -p -r1.3 -r1.4
--- roff_escape.c
+++ roff_escape.c
@@ -158,6 +158,7 @@ roff_escape(const char *buf, const int l
case '$':
case '*':
case 'V':
+ case 'g':
case 'n':
rval = ESCAPE_EXPAND;
break;
@@ -165,7 +166,6 @@ roff_escape(const char *buf, const int l
case 'M':
case 'O':
case 'Y':
- case 'g':
case 'k':
case 'm':
rval = ESCAPE_IGNORE;
Index: roff.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/roff.c,v
retrieving revision 1.389
retrieving revision 1.390
diff -Lroff.c -Lroff.c -u -p -r1.389 -r1.390
--- roff.c
+++ roff.c
@@ -1535,6 +1535,8 @@ roff_expand(struct roff *r, struct buf *
roff_expand_patch(buf, iendarg, "}", iend);
roff_expand_patch(buf, iesc, "${", iarg);
continue;
+ case 'g':
+ break;
case 'n':
if (iendarg > iarg)
(void)snprintf(ubuf, sizeof(ubuf), "%d",
--
To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv
reply other threads:[~2022-05-31 18:10 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=336596d87b415673@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).