my $type=pagetype($file);
my $page=$file;
- $page=~s/\Q.$type\E*$// if defined $type;
+ $page=~s/\Q.$type\E*$// if defined $type && !$hooks{htmlize}{$type}{keepextension};
return $page;
} #}}}
* editpage: Add a missing check that the page name contains only legal
characters, in addition to the existing check for pruned filenames.
* Print a debug message if a page has multiple source files.
+ * Add keepextension parameter to htmlize hook. (Willu)
-- Joey Hess <joeyh@debian.org> Wed, 17 Sep 2008 14:26:56 -0400
>> have struggled with. It makes sense. It doesn't solve the case where
>> you have source files without any extension (eg `Makefile`), but at
>> least it covers the common cases.
+>>
+>> I'm going to be annoying and call it "keepextension", otherwise, applied
+>> as-is. --[[Joey]] [[done]]
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 4e4da11..853f905 100644
I wonder if this patch will also be useful:
+> Reasonable, applied.
+
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index 752d176..3f1b67b 100644
--- a/IkiWiki/Render.pm
The function is passed named parameters: "page" and "content" and should
return the htmlized content.
+If `hook` is passed an optional "keepextension" parameter, set to a true
+value, then this extension will not be stripped from the source filename when
+generating the page.
+
### pagetemplate
hook(type => "pagetemplate", id => "foo", call => \&pagetemplate);
BEGIN { use_ok("IkiWiki"); }
# Used internally.
-$IkiWiki::hooks{htmlize}{mdwn}=1;
+$IkiWiki::hooks{htmlize}{mdwn}{call}=sub {};
is(pagename("foo.mdwn"), "foo");
is(pagename("foo/bar.mdwn"), "foo/bar");