From 2317cc3fe30e244701a4c419da78527f392dccaf Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 14 Nov 2004 09:48:05 +0000 Subject: 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. --- man/help2man | 10 ++++++++++ 1 file changed, 10 insertions(+) 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; } } -- cgit v1.2.3-54-g00ecf