From f9568fed2ebb8d272c653d6fd12e1dd4b07ea1a4 Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Thu, 15 Mar 2007 00:56:14 +0300 Subject: [PATCH] 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 --- lib/Pod/Html.pm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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; } -- 1.8.3.1