]> sipb.mit.edu Git - ikiwiki.git/blobdiff - doc/bugs/multiple_pages_with_same_name.mdwn
Add keepextension parameter to htmlize hook. (Willu)
[ikiwiki.git] / doc / bugs / multiple_pages_with_same_name.mdwn
index 26269c9ce9227041238b122d272256ded9f4aaa3..5ddfb1f6b17bad4e992e8947095780564655f255 100644 (file)
@@ -4,6 +4,10 @@ I realised that this is going to have problems when you ask it to process `.c` a
 
 I tested it briefly with `test.java` and `test.mdwn` just to see what would happen.  Things got quite strange.  The source-highlighting plugin was called (probably for the java file), but then when it calls `pagetype($pagesources{$page})` to figure out the file type, that function returns `mdwn`, which confuses things somewhat.
 
+> This is a known possible point of confusion. If there are multiple source
+> files, it will render them both, in an arbitrary sequence, so one "wins".
+> --[[Joey]]
+
 Anyway, I'm thinking about possible solutions.  The best option I've come up with so far is: when registering an htmlize hook, add a new optional paramter 'keep_extension'.  This would make a source file of `hello.c` generate a page with name `hello.c` rather than the current `hello`.  This would keep the pages unique (until someone makes `hello.c.mdwn`...).
 
 Suggestions welcome.
@@ -12,6 +16,14 @@ Suggestions welcome.
 
 > Ok, this turned out not to be a hard change.  [[patch]] is below.  With this patch you can tell IkiWiki not to drop the suffix when you register a hook: `hook(type => "htmlize", id => $lang, call => \&htmlize, leavesuffix => 1);`
 
+>> I think that's a good solution to the problem that most syntax plugins
+>> 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
     --- a/IkiWiki.pm
@@ -43,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