diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-10-15 19:36:48 -0400 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-10-15 19:36:48 -0400 |
commit | 1f7f5d5e0e21920c5f15290cd34594ad91077071 (patch) | |
tree | a19302c57ed6ea46c4bf05a1ed8d840725643069 /doc/todo/modify_page_filename_in_plugin.mdwn | |
parent | 917f54a777d152ee5963acd81bf8a2800a0507b1 (diff) | |
parent | 20e691fe20ead76d826ab77501c6e9cbc7b487e8 (diff) |
Merge branch 'master' into darcs
Diffstat (limited to 'doc/todo/modify_page_filename_in_plugin.mdwn')
-rw-r--r-- | doc/todo/modify_page_filename_in_plugin.mdwn | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/doc/todo/modify_page_filename_in_plugin.mdwn b/doc/todo/modify_page_filename_in_plugin.mdwn new file mode 100644 index 000000000..7c0a909eb --- /dev/null +++ b/doc/todo/modify_page_filename_in_plugin.mdwn @@ -0,0 +1,33 @@ +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 ($) { #{{{ + |