summaryrefslogtreecommitdiff
path: root/news/2005-08-20.mdwn
authorJamey Sharp <jamey@minilop.net>2007-08-09 19:17:12 (GMT)
committer Jamey Sharp <jamey@minilop.net>2007-08-09 19:17:12 (GMT)
commitefc6854786e8b97bf1331ae3d561f0f3c75f9e63 (patch) (side-by-side diff)
treeab4a9520f2a5077a2a859e6fbb605a431f7cd4c8 /news/2005-08-20.mdwn
parent18b49b42e509551be902aeeaa53fff94820fe86d (diff)
downloadwiki-efc6854786e8b97bf1331ae3d561f0f3c75f9e63.zip
wiki-efc6854786e8b97bf1331ae3d561f0f3c75f9e63.tar.gz
Replace absolute links to http://psas.pdx.edu using Ikiwiki links.
Absolute links to images are not replaced, because that would change the generated HTML--it would generate <img> tags instead of <a> links. Mostly handled automatically, with a little hand-editing. find -name '*.mdwn' | xargs ../wikilink wikilink: #!/usr/bin/perl -pi use warnings; use strict; BEGIN { $::pat = qr{\Qhttp://psas.pdx.edu/\E(?!albums/|cgi-bin/|viewfile/|attach/)(?:PSAS/)?}; $::uri = qr{="(?:$::pat)([^"]*)"}; $::img = qr{<img ([^>]*src="(?:$::pat)[^"]*"[^>]*)>}; } sub mdwn { my ($target, $alt) = @_; if($alt) { $alt =~ s/^\s*(.*?)\s*$/$1/; (my $realalt = $alt) =~ s/\\//g; $alt = '' if $target =~ m{/\Q$realalt\E$}; } $alt = $alt ? $alt . '|' : ''; $target =~ s/\.html$//; return '[[' . $alt . $target . ']]'; } sub img { my @attrs = split(' ', $_[0]); my ($src, $alt); foreach(@attrs) { /^(.*?)=["']?(.*?)["']?$/; $src = $2 if $1 eq "src"; $alt = $2 if $1 eq "alt"; } $src =~ s/^$::pat//o; return mdwn($src, $alt); } s!<a href(?:$::uri)[^>]*>\s*(.*?)\s*</a>!mdwn($1, $2)!iego; s!$::img!img($1)!ego; s!\!\[\s*([^]]*)\s*\]\((?:$::pat)([^)]*\.(?:png|gif|jpg|jpeg))\)!mdwn($2, $1)!ego; s{\[\s*([^]]*)\s*\]\((?:$::pat)([^)]*)(?<!png|gif|jpg)(?<!jpeg)\)}{mdwn($2, $1)}ego;
Diffstat (limited to 'news/2005-08-20.mdwn') (more/less context) (ignore whitespace changes)
-rw-r--r--news/2005-08-20.mdwn2
1 files changed, 1 insertions, 1 deletions
diff --git a/news/2005-08-20.mdwn b/news/2005-08-20.mdwn
index 18cd3b3..c4bf487 100644
--- a/news/2005-08-20.mdwn
+++ b/news/2005-08-20.mdwn
@@ -147,6 +147,6 @@ So... anyone up for LV2.3? Or how about LV3? ;)
----
-_Note: To see the launch logistics page, please see the previous revision [here](http://psas.pdx.edu/news/2005-08-20?rev=1.09)._
+_Note: To see the launch logistics page, please see the previous revision [[here|news/2005-08-20?rev=1.09]]._
[[tag event announcement]]