diff options
author | G. Branden Robinson <g.branden.robinson@gmail.com> | 2018-11-10 10:00:01 -0500 |
---|---|---|
committer | G. Branden Robinson <g.branden.robinson@gmail.com> | 2018-11-10 10:02:39 -0500 |
commit | f61089db04816e30cc9045988a4c80f84d0350d7 (patch) | |
tree | e86e9e5aa553c0cb081d28f4e2d0ddd2743e826e /makevarescape.sed | |
parent | 9e4c49a2c4d8b80495e1564ca805d7bb72289a62 (diff) | |
download | groff-git-f61089db04816e30cc9045988a4c80f84d0350d7.tar.gz |
man pages: Escape interpolated Make variables.
* makevarescape.sed: Transform - to \-, ~ to \(ti, and so forth,
(with an extra layer of backslashes--see below) so that Makefile
variables containing ASCII characters that do not represent
themselves literally in *roff (see groff_char(7)) are correctly
interpolated into man page text.
* Makefile.am (.man): Transform Makefile variables with the
above script when interpolating them into man page text.
Note that while the script, combined with this target, will
transform ` to \(ga, including grave accents in Makefile
variables is likely to fail when the shell lexes the argument to
echo within the old-style command substitution ``. Testing
shows that grave accents should work[1] if POSIX-style command
substitution $() is done instead. However, $() is less
portable. (Triple-escaping grave accents \\\` inside the
interpolated Makefile variable will work, but is not attempted
at present.)
Note also that the amount of backslash-escaping in the sed
script is excessive (and incorrect) for normal purposes, but
required here because a command substitution is being nested
inside yet another invocation of sed.
[1] For this target; no assurances about the good behavior of
unusual characters in Makefile variables in other aspects of the
groff build are offered.
Fixes <https://savannah.gnu.org/bugs/index.php?55004>.
Signed-off-by: G. Branden Robinson <g.branden.robinson@gmail.com>
Diffstat (limited to 'makevarescape.sed')
-rw-r--r-- | makevarescape.sed | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/makevarescape.sed b/makevarescape.sed new file mode 100644 index 000000000..54f551300 --- /dev/null +++ b/makevarescape.sed @@ -0,0 +1,6 @@ +s/\\/\\\\e/g +s/'/\\\\(aq/g +s/-/\\\\&/g +s/\^/\\\\(ha/g +s/`/\\\\(ga/g +s/~/\\\\(ti/g |