]> sipb.mit.edu Git - ikiwiki.git/commitdiff
Add keepextension parameter to htmlize hook. (Willu)
authorJoey Hess <joey@kodama.kitenet.net>
Tue, 23 Sep 2008 17:39:21 +0000 (13:39 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Tue, 23 Sep 2008 17:39:21 +0000 (13:39 -0400)
IkiWiki.pm
debian/changelog
doc/bugs/multiple_pages_with_same_name.mdwn
doc/plugins/write.mdwn
t/pagename.t

index 4e4da11c5a016daa9d04c0b6ee04df7f786a14a7..c0f5deab60909e825e11d62a85a9fd170ef523df 100644 (file)
@@ -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;
 } #}}}
 
index 5f7cc1be233ad8fb6713d4dfb46b0b7c9d2e0840..df5bc5942c4a6e2b49eaf739d321ea2b3bea3ded 100644 (file)
@@ -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
 
index 548954f8f94f9977fe2a40afdbf3511fe89ad069..5ddfb1f6b17bad4e992e8947095780564655f255 100644 (file)
@@ -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
index 920fb8797cfa4a1d09e0947e261dc7455f1f89c7..37a6d6f894c56a7af3550126a8a594abfa85aca0 100644 (file)
@@ -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);
index 96e6a87f11e87b4e8e945ccc077dc40a2e826ef9..c7f1ce1801d92ee470f901e7f9f1eca35a6fa6fb 100755 (executable)
@@ -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");