From: Gurusamy Sarathy Date: Tue, 14 Mar 2000 20:06:23 +0000 (+0000) Subject: protect special characters better against interpretation by *roff X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=44464a025e4f32b72b835ec046467cda7099ad1d;p=p5sagit%2Fp5-mst-13.2.git protect special characters better against interpretation by *roff (from Russ Allbery) p4raw-id: //depot/perl@5737 --- diff --git a/lib/Pod/Man.pm b/lib/Pod/Man.pm index 898b544..3ba26a3 100644 --- a/lib/Pod/Man.pm +++ b/lib/Pod/Man.pm @@ -264,13 +264,13 @@ $PREAMBLE = <<'----END OF PREAMBLE----'; # Static helper functions ############################################################################ -# Protect leading quotes and periods against interpretation as commands. A -# leading *roff font escape apparently still leaves a period interpretable -# as a command by some *roff implementations, so look for a period even -# after one of those. +# Protect leading quotes and periods against interpretation as commands. +# Also protect anything starting with a backslash, since it could expand +# or hide something that *roff would interpret as a command. This is +# overkill, but it's much simpler than trying to parse *roff here. sub protect { local $_ = shift; - s{ ^ ( (?: \\f(?:.|\(..) )* [.\'] ) } {\\&$1}xmg; + s/^([.\'\\])/\\&$1/mg; $_; }