summaryrefslogtreecommitdiff
path: root/news/2003-09-21.mdwn
authorJamey Sharp <jamey@minilop.net>2007-08-09 20:17:07 (GMT)
committer Jamey Sharp <jamey@minilop.net>2007-08-09 20:22:02 (GMT)
commit53c3c66fd05f2cfd9c399ff347b8815f231998a1 (patch) (side-by-side diff)
tree1c2f8f485c4e9eb58aa5126a0653e46bd1b28e19 /news/2003-09-21.mdwn
parentc631956fabb8f3e1376c81a3a005d31165deef54 (diff)
downloadwiki-53c3c66fd05f2cfd9c399ff347b8815f231998a1.zip
wiki-53c3c66fd05f2cfd9c399ff347b8815f231998a1.tar.gz
Replace relative links with Ikiwiki links.
Eliminates 119 "orphan" warnings on AdminHome/issues and fixes the conversion problems with CapstoneLV2bProjectReport. Links to images are not replaced, because that would change the generated HTML--it would generate <img> tags instead of <a> links. Handled with an enhanced version of my previous wikilink script. 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/)?|(?!https?://|ftp://|mailto:|#)}; $::img = qr{<img ([^>]*src="(?:$::pat)[^"]*"[^>]*)>}; $::uri = qr{="(?:$::pat)([^"]*)(?<!png|gif|jpg)(?<!jpeg)"}; } 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!$::img!img($1)!iego; s!<a href(?:$::uri)[^>]*>\s*(.*?)\s*</a>!mdwn($1, $2)!iego; s!\!\[\s*([^]]*)\s*\]\((?:$::pat)([^)]*\.(?:png|gif|jpg|jpeg))\)!mdwn($2, $1)!iego; s{\[\s*([^]]*)\s*\]\((?:$::pat)([^)]*)(?<!png|gif|jpg)(?<!jpeg)\)}{mdwn($2, $1)}iego;
Diffstat (limited to 'news/2003-09-21.mdwn') (more/less context) (ignore whitespace changes)
-rw-r--r--news/2003-09-21.mdwn2
1 files changed, 1 insertions, 1 deletions
diff --git a/news/2003-09-21.mdwn b/news/2003-09-21.mdwn
index bc5d795..3b4bf29 100644
--- a/news/2003-09-21.mdwn
+++ b/news/2003-09-21.mdwn
@@ -134,6 +134,6 @@ Misc Links:
- [[Tee Shirt Info|TeeShirts2003]]
- [[Black Rock 2003 Logistics Page|BlackRockLogistics2003]]
-- [September 2003 BRD Range Fees](/RangeFee)
+- [[September 2003 BRD Range Fees|/RangeFee]]
[[tag event]]