Add keepextension parameter to htmlize hook. (Willu)
parent
9cbcda14ac
commit
dfe55e8956
|
@ -618,7 +618,7 @@ sub pagename ($) { #{{{
|
|||
|
||||
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;
|
||||
} #}}}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ ikiwiki (2.65) UNRELEASED; urgency=low
|
|||
* 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
|
||||
|
||||
|
|
|
@ -20,6 +20,9 @@ Suggestions welcome.
|
|||
>> 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
|
||||
|
@ -52,6 +55,8 @@ Suggestions welcome.
|
|||
|
||||
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
|
||||
|
|
|
@ -188,6 +188,10 @@ languages to ikiwiki.
|
|||
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);
|
||||
|
|
|
@ -6,7 +6,7 @@ use Test::More tests => 5;
|
|||
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");
|
||||
|
|
Loading…
Reference in New Issue