diff options
author | Jari Aalto <jari.aalto@poboxes.com> | 2007-03-15 00:56:14 +0300 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-03-16 15:18:07 +0000 |
commit | f9568fed2ebb8d272c653d6fd12e1dd4b07ea1a4 (patch) | |
tree | e06d0b0bfd9bfc3c86f45973cee9b82b1292dea9 /lib/Pod | |
parent | c1bd9b63a6f9fb1ff545c1522739c385d3c1902f (diff) | |
download | perl-f9568fed2ebb8d272c653d6fd12e1dd4b07ea1a4.tar.gz |
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
Diffstat (limited to 'lib/Pod')
-rw-r--r-- | lib/Pod/Html.pm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/Pod/Html.pm b/lib/Pod/Html.pm index 32b71e1fb6..8dd04158a7 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<a href="http://www.ietf.org/rfc/rfc$3.txt">$2</a>}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; } |