diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-09-23 13:39:21 -0400 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-09-23 13:39:21 -0400 |
commit | dfe55e8956fdcb8ee11b85b238a7d27f42063746 (patch) | |
tree | c82c0a2f05f719a7401b40eb4d49daede7d9ed17 | |
parent | 9cbcda14aca677008a7e2fe70463deda5cbdf34b (diff) | |
download | ikiwiki-dfe55e8956fdcb8ee11b85b238a7d27f42063746.tar ikiwiki-dfe55e8956fdcb8ee11b85b238a7d27f42063746.tar.gz |
Add keepextension parameter to htmlize hook. (Willu)
-rw-r--r-- | IkiWiki.pm | 2 | ||||
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | doc/bugs/multiple_pages_with_same_name.mdwn | 5 | ||||
-rw-r--r-- | doc/plugins/write.mdwn | 4 | ||||
-rwxr-xr-x | t/pagename.t | 2 |
5 files changed, 12 insertions, 2 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index 4e4da11c5..c0f5deab6 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -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; } #}}} diff --git a/debian/changelog b/debian/changelog index 5f7cc1be2..df5bc5942 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 diff --git a/doc/bugs/multiple_pages_with_same_name.mdwn b/doc/bugs/multiple_pages_with_same_name.mdwn index 548954f8f..5ddfb1f6b 100644 --- a/doc/bugs/multiple_pages_with_same_name.mdwn +++ b/doc/bugs/multiple_pages_with_same_name.mdwn @@ -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 diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 920fb8797..37a6d6f89 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -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); diff --git a/t/pagename.t b/t/pagename.t index 96e6a87f1..c7f1ce180 100755 --- a/t/pagename.t +++ b/t/pagename.t @@ -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"); |