diff options
author | rsc <devnull@localhost> | 2005-02-15 05:07:26 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-02-15 05:07:26 +0000 |
commit | 7383736cf8254264733aa055a4d854e007f5f83c (patch) | |
tree | 028756f3bc59b1ea10c00333278eaa4f0dac462e /dist/addsrclinks | |
parent | 0c891f28dbdc5a61b191d778391664417aae445c (diff) | |
download | plan9port-7383736cf8254264733aa055a4d854e007f5f83c.tar.gz plan9port-7383736cf8254264733aa055a4d854e007f5f83c.tar.bz2 plan9port-7383736cf8254264733aa055a4d854e007f5f83c.zip |
add source links
Diffstat (limited to 'dist/addsrclinks')
-rwxr-xr-x | dist/addsrclinks | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/dist/addsrclinks b/dist/addsrclinks new file mode 100755 index 00000000..f0311aa8 --- /dev/null +++ b/dist/addsrclinks @@ -0,0 +1,24 @@ +#!/usr/bin/perl + +@_ = <>; +my $root = $ENV{'PLAN9'}; +my $html = join("", @_); +$html =~ s;$root;XXX$root;g; +while($html =~ /((.|\n)*)XXX($root\/([a-zA-Z0-9_.\/]|−)*[a-zA-Z0-9_\/])((.|\n)*)/){ + ($a, $b, $c) = ($1, $3, $5); + $b =~ s/−/-/g; + $l = $b; + while(! -e $l){ + if($l =~ /(.*\/)(.+)/){ + $l = $1; + }else{ + last; + } + } + $bb = substr($b, length($l)); + $b = $l; + $b =~ s/-/\−/g; + $bb =~ s/-/\−/g; + $html = "$a<a href=\"$l\">$b</a>$bb$c"; +} +print $html; |