#!/usr/bin/perl # twiklien.pl 20050114-02 by David Turover # Clean up twiki html pages for static distribution # Note: This is a quick hack and misses a few things use strict; my($file); while(<>){ $file = $file . $_; } # Move $file back into $_ for ease of typing $_ = $file; # Start cleaning up s%=\n%=%sg; s%= %=%sg; # Remove background colour for undocumented WikiWords s%background *: *#FFFFCE;%%sg; # Remove "Edit?" links for undocumented WikiWords s%\s?\?\s?%%sg; # Blam edit links s%href="/twiki/bin/edit[^"]*"%%sg; # Change twiki links to relative links while(/twiki\/bin\/view\/PW/){ s%/twiki/bin/view/PW/([^"]*)%$1.html%; # Check to see that the relative link exists if(! -e "$1.html"){ #print STDERR "Could not find $1.html\n"; # Debug s%$1.html%%; } } # Blam link fonts s%"#0000FF"%%g; # Blam remaining Twiki links s%"/twiki/[^"]*"%""%g; # Blam external links s%href="http:[^"]*"%%g; # Blam empty links s%href=""%%g; print;