summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2004-11-14 09:48:05 +0000
committerJim Meyering <jim@meyering.net>2004-11-14 09:48:05 +0000
commit2317cc3fe30e244701a4c419da78527f392dccaf (patch)
tree4727f6e462acf7da04c4b791705bf47eb4c56a64
parent81720d306e51520bbc5e5e522433d73dae311122 (diff)
downloadcoreutils-2317cc3fe30e244701a4c419da78527f392dccaf.tar.xz
Backslash-escape `-'s in email addresses, so that they are
rendered properly in UTF-locales. (escape_hyphens): New function. (main): Call it on email addresses.
-rwxr-xr-xman/help2man10
1 files changed, 10 insertions, 0 deletions
diff --git a/man/help2man b/man/help2man
index a0f1be039..e8ea71854 100755
--- a/man/help2man
+++ b/man/help2man
@@ -46,6 +46,13 @@ BEGIN {
}
}
+sub escape_hyphens($)
+{
+ my ($s) = @_;
+ $s =~ s/-/\\-/g;
+ return $s;
+}
+
sub _ { gettext @_ }
sub N_ { $_[0] }
@@ -599,6 +606,9 @@ for my $sect (@pre, (grep ! /^($filter)$/o, @include), @post)
# Convert some latin1 chars to troff equivalents
s/\xa0/\\ /g; # non-breaking space
+ # Escape hyphens in <>-enclosed email addresses.
+ s/(<\S+\@(\S+\.)+\S{2,}>)/escape_hyphens $1/ge;
+
print;
}
}