Subject: | Replacement of some characters with X |
I noticed that things like E<copy> and E<pound> are rendered as X by
Pod::Man, though these are rendered as expected in HTML etc. The correct
behaviour seems to occur with "pod2man --utf8", but I couldn't find an
easy way of making perldoc pass that option on.
The attached patch worked for me, it adds mappings to roff escapes for
latin-1 characters 0xa0 to 0xbf, 0xd7 and 0xf7. Based on the groff_chars
man page.
Subject: | pod_man_escapes.patch |
--- lib/Pod/Man.pm
+++ lib/Pod/Man.pm
@@ -1315,22 +1315,56 @@
# This only works in an ASCII world. What to do in a non-ASCII world is very
# unclear -- hopefully we can assume UTF-8 and just leave well enough alone.
@ESCAPES{0xA0 .. 0xFF} = (
- "\\ ", undef, undef, undef, undef, undef, undef, undef,
- undef, undef, undef, undef, undef, "\\%", undef, undef,
-
- undef, undef, undef, undef, undef, undef, undef, undef,
- undef, undef, undef, undef, undef, undef, undef, undef,
-
+ # 0xa0
+ "\\ ", # non-breaking space
+ "\\[r!]", # inverted exclamation mark
+ "\\[ct]", # cent
+ "\\[Po]", # pound sterling
+ "\\[Cs]", # currency symbol
+ "\\[Ye]", # yen
+ "\\[bb]", # broken bar
+ "\\[sc]", # section
+ "\\[ad]", # diaresis
+ "\\[co]", # copyright
+ "\\[Of]", # feminine ordinal indicator
+ "\\[Fo]", # left guillemot
+ "\\[no]", # logical not
+ "\\%", # roff special
+ "\\[rg]", # registered
+ "\\[a-]", # macron
+
+ # 0xb0
+ "\\[de]", # degree
+ "\\[+-]", # plusminus
+ "\\[S2]", # superscript 2
+ "\\[S3]", # superscript 3
+ "\\[aa]", # acute accent
+ "\\[mc]", # micro sign
+ "\\[ps]", # paragraph
+ "\\[pc]", # centered period
+ "\\[ac]", # cedilla accent
+ "\\[S1]", # superscript 1
+ "\\[Om]", # masculine ordinal indicator
+ "\\[Fc]", # right guillemot
+ "\\[14]", # one quarter
+ "\\[12]", # one half
+ "\\[34]", # three quarters
+ "\\[r?]", # inverted question mark
+
+ # 0xc0
"A\\*`", "A\\*'", "A\\*^", "A\\*~", "A\\*:", "A\\*o", "\\*(AE", "C\\*,",
"E\\*`", "E\\*'", "E\\*^", "E\\*:", "I\\*`", "I\\*'", "I\\*^", "I\\*:",
- "\\*(D-", "N\\*~", "O\\*`", "O\\*'", "O\\*^", "O\\*~", "O\\*:", undef,
+ # 0xd0
+ "\\*(D-", "N\\*~", "O\\*`", "O\\*'", "O\\*^", "O\\*~", "O\\*:", "\\[mu]",
"O\\*/", "U\\*`", "U\\*'", "U\\*^", "U\\*:", "Y\\*'", "\\*(Th", "\\*8",
+ # 0xe0
"a\\*`", "a\\*'", "a\\*^", "a\\*~", "a\\*:", "a\\*o", "\\*(ae", "c\\*,",
"e\\*`", "e\\*'", "e\\*^", "e\\*:", "i\\*`", "i\\*'", "i\\*^", "i\\*:",
- "\\*(d-", "n\\*~", "o\\*`", "o\\*'", "o\\*^", "o\\*~", "o\\*:", undef,
+ # 0xf0
+ "\\*(d-", "n\\*~", "o\\*`", "o\\*'", "o\\*^", "o\\*~", "o\\*:", "\\[di]",
"o\\*/" , "u\\*`", "u\\*'", "u\\*^", "u\\*:", "y\\*'", "\\*(th", "y\\*:",
) if ASCII;
--- t/man.t
+++ t/man.t
@@ -226,11 +226,11 @@
###
=head1 YEN
-It cost me E<165>12345! That should be an X.
+It cost me E<165>12345! That should not be an X.
###
.SH "YEN"
.IX Header "YEN"
-It cost me X12345! That should be an X.
+It cost me \[Ye]12345! That should not be an X.
###
###