X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/81ae47421bd9bfc0797ddba5f23c2ef76058172d..3bb00d142a4d31316fc6f0eb1277aa2fafe4dbe9:/doc/plugins/contrib/siterel2pagerel.mdwn?ds=inline diff --git a/doc/plugins/contrib/siterel2pagerel.mdwn b/doc/plugins/contrib/siterel2pagerel.mdwn index 7bdeea965..9b09657bf 100644 --- a/doc/plugins/contrib/siterel2pagerel.mdwn +++ b/doc/plugins/contrib/siterel2pagerel.mdwn @@ -1,4 +1,9 @@ -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: +[[!template id=plugin name=siterel2pagerel author="[[PaulWise]]"]] + +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 siterel2pagerel link hack by Paul Wise @@ -8,11 +13,11 @@ This is a simple plugin to convert all site-relative links to page-relative link use strict; use IkiWiki 2.00; - sub import { #{{{ + sub import { hook(type => "sanitize", id => "siterel2pagerel", call => \&siterel2pagerel); - } # }}} + } - sub siterel2pagerel (@) { #{{{ + sub siterel2pagerel (@) { my %params=@_; my $baseurl=IkiWiki::baseurl($params{page}); my $content=$params{content}; @@ -20,6 +25,6 @@ This is a simple plugin to convert all site-relative links to page-relative link $content=~s/(