summaryrefslogtreecommitdiff
path: root/doc/todo/modify_page_filename_in_plugin.mdwn
blob: 4099487a12193ff8d725506bb0f5c19b666ae909 (plain)

I'm writing a plugin to wikify c/c++ code.

By default ikiwiki generates xxx.html for a file called xxx.c.

The problem is that I occasionally have xxx.c and xxx.h in the same directory and there's a filename collision.

My solution is to allow plugins to provide a hook that sets the pagename. --[[/users/bstpierre]]

--- /usr/share/perl5/IkiWiki.pm.ORIG    2008-10-03 14:12:50.000000000 -0400
+++ /usr/share/perl5/IkiWiki.pm 2008-10-07 11:57:26.000000000 -0400
@@ -196,11 +196,32 @@

 sub pagename ($) {
        my $file=shift;

        my $type=pagetype($file);
+
+   if(defined $type &&
+      exists $hooks{pagename} &&
+      exists $hooks{pagename}{$type}) {
+
+      return $hooks{pagename}{$type}{call}($file);
+
+   } else {
+
        my $page=$file;
        $page=~s/\Q.$type\E*$// if defined $type;
        return $page;
+   }
 }

 sub htmlpage ($) {
bee9b6dcd093214a220d'>fd54908da2b05c526dd3bee9b6dcd093214a220d (patch) treec69c845069c99d1d01044f6fafda7c08433329c6 /tags/02/96/mailman.96.1682751604.23750.design-devel@alioth-lists.debian.net parentba46132213560cf3335d53560d519c0ec0190da2 (diff)
master
Diffstat (limited to 'tags/02/96/mailman.96.1682751604.23750.design-devel@alioth-lists.debian.net')
-rw-r--r--tags/02/96/mailman.96.1682751604.23750.design-devel@alioth-lists.debian.net/inbox0
-rw-r--r--tags/02/96/mailman.96.1682751604.23750.design-devel@alioth-lists.debian.net/killed0
-rw-r--r--tags/02/96/mailman.96.1682751604.23750.design-devel@alioth-lists.debian.net/unread0
3 files changed, 0 insertions, 0 deletions