From: joey Date: Thu, 9 Aug 2007 06:42:36 +0000 (+0000) Subject: web commit by PaulWise X-Git-Tag: 2.6~198 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5644e171d0c25697cf338a51e28e9ce814e3ac13;p=ikiwiki.git web commit by PaulWise --- diff --git a/doc/plugins/contrib/siterel2pagerel.mdwn b/doc/plugins/contrib/siterel2pagerel.mdwn new file mode 100644 index 000000000..50d901417 --- /dev/null +++ b/doc/plugins/contrib/siterel2pagerel.mdwn @@ -0,0 +1,25 @@ +This is a simple plugin to convert all site-relative links to page-relative links (converts /foo into ../../../foo or similar). It works as a postprocessing filter, allowing it to work on mdwn, wiki, html, rst and any other format that produces html. The code is available here: + + #!/usr/bin/perl + # quick HTML abs2rel link hack by Paul Wise + package IkiWiki::Plugin::siterel2pagerel; + + use warnings; + use strict; + use IkiWiki 2.00; + + sub import { #{{{ + hook(type => "sanitize", id => "siterel2pagerel", call => \&siterel2pagerel); + } # }}} + + sub siterel2pagerel (@) { #{{{ + my %params=@_; + my $baseurl=IkiWiki::baseurl($params{page}); + my $content=$params{content}; + $content=~s/(