]> sipb.mit.edu Git - ikiwiki.git/commitdiff
added hook urlpath
authorintrigeri <intrigeri@boum.org>
Tue, 7 Oct 2008 22:50:10 +0000 (00:50 +0200)
committerintrigeri <intrigeri@boum.org>
Sat, 18 Oct 2008 13:49:08 +0000 (15:49 +0200)
This hook can be used to modify the internal urls generated by ikiwiki.

Signed-off-by: intrigeri <intrigeri@boum.org>
IkiWiki.pm
IkiWiki/Plugin/skeleton.pm.example
doc/plugins/write.mdwn

index 28ee882cf20d99b30059cf195ca8f70881de932d..e75175a8dfb3cc6115a018b3bf63aa2674e82496 100644 (file)
@@ -927,6 +927,10 @@ sub beautify_urlpath ($) { #{{{
                $url =~ s!/index.$config{htmlext}$!/!;
        }
 
+       run_hooks(urlpath => sub {
+               $url=shift->(url => $url);
+       });
+
        # Ensure url is not an empty link, and
        # if it's relative, make that explicit to avoid colon confusion.
        if ($url !~ /^\//) {
index af22b340659bd72067c1cd552e69c221dd7ab364..ecf2a2407ca135d91503b4ebe3ed27d7bebf89f3 100644 (file)
@@ -35,6 +35,7 @@ sub import { #{{{
        hook(type => "formbuilder", id => "skeleton", call => \&formbuilder);
        hook(type => "savestate", id => "skeleton", call => \&savestate);
        hook(type => "targetpage", id => "skeleton", call => \&targetpage);
+       hook(type => "urlpath", id => "skeleton", call => \&urlpath);
 } # }}}
 
 sub getopt () { #{{{
@@ -209,4 +210,8 @@ sub targetpage () { #{{{
        debug("skeleton plugin running in targetpage");
 } #}}}
 
+sub urlpath () { #{{{
+       debug("skeleton plugin running in urlpath");
+} #}}}
+
 1
index 6d2622272f01eaa5ed65d0fc496e886633fdf8c7..15f6c8a208e9b348bfe4a8461e23ce521a465055 100644 (file)
@@ -437,6 +437,16 @@ be compiled into.
 
 It should return the target filename.
 
+### urlpath
+
+       hook(type => "urlpath", id => "foo", call => \&urlpath);
+
+This hook can be used to modify the internal urls generated by
+ikiwiki; it is run just after ikiwiki has removed the trailing
+`index.html`, in case `usedirs` is enabled.
+
+It should return the modified url.
+
 ## Plugin interface
 
 To import the ikiwiki plugin interface: