From: Jari Aalto Date: Wed, 14 Mar 2007 21:56:14 +0000 (+0300) Subject: Re: [perl #41691] [PATCH] v5.8.8 pod2html -- Convert RFC links to point ot IETF pages X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f9568fed2ebb8d272c653d6fd12e1dd4b07ea1a4;p=p5sagit%2Fp5-mst-13.2.git Re: [perl #41691] [PATCH] v5.8.8 pod2html -- Convert RFC links to point ot IETF pages Message-ID: <87hcsnbqnl.fsf@w2kpicasso.cante.net> p4raw-id: //depot/perl@30604 --- diff --git a/lib/Pod/Html.pm b/lib/Pod/Html.pm index 32b71e1..8dd0415 100644 --- a/lib/Pod/Html.pm +++ b/lib/Pod/Html.pm @@ -1505,6 +1505,24 @@ sub process_text { $$tref = $res; } +sub process_text_rfc_links { + my $text = shift; + + # For every "RFCnnnn" or "RFC nnn" link it to the authoritative + # source. Do not use (i) option here. Require RFC to be written in + # in capital letters. + + $text =~ s{ + (?=^\S) # positive lookahead, make sure this is "text" paragraph + (.*?) # Grab leading text + (?<=[^<>]) # Make sure this is not an URL already + (RFC\s*(\d{1,5}))(?=\s) # max 5 digits + } + {$1$2}gx; + + $text; +} + sub process_text1($$;$$){ my( $lev, $rstr, $func, $closing ) = @_; my $res = ''; @@ -1693,6 +1711,7 @@ sub process_text1($$;$$){ } else { warn "$0: $Podfile: undelimited $func<> in paragraph $Paragraph.\n" unless $Quiet; } + $res = process_text_rfc_links($res); } return $res; }