-
2006-11-28
mt
When I create a link [[items:]] inside a wiki page DW turns this link properly into 'items:start'
(start being the global start page name — $conf['start']).
When typing 'doku.php?id=items:' into the addressbar I should get to the same page.
Right now it clips the ":" off and tries to find a page 'items' in the root namespace
-
2006-11-29
gb
Confirmed.
I traced back to the commits which implemented this namespace auto linking feature and could never get it work. So this is not implemented yet :-(
-
2006-11-29
gb
BTW, tracing back with darcs is really a PITA!
-
2006-11-29
gb
This one line simple patch implements the requested behavior, though it's probably not the right place where to do it.
diff -r 6d63446808c6 doku.php
--- a/doku.php Mon Nov 27 22:33:56 2006 +0000
+++ b/doku.php Wed Nov 29 13:12:26 2006 +0100
@@ -33,6 +33,8 @@
$PRE = cleanText($_POST['prefix']);
$SUF = cleanText($_POST['suffix']);
$SUM = $_REQUEST['summary'];
+
+ if(!noNS($QUERY) && getNS($QUERY)) $ID .= ":" . $conf['start'];
//sanitize revision
$REV = preg_replace('/[^0-9]/','',$REV);
Tested against tip/HEAD revision.
-
2006-11-30
ChrisS
Guy, what is the correct behaviour when a namespace is given?
There is currently one test case which fails and its related to this. The code checks for three different things
namespace:namespace
namespace:start
namespace
if it doesn't find any of the above, it'll go for namespace:start, although as mentioned above it appears it sometimes opts for namespace.
(all of the above is my recollection - I'm not looking at the code right now)
So, what is the correct behaviour?
-
2006-11-30
andi
The test case you mention only fails if a certain page exists, where the code assumes it does not exist (not looking at the code currently either). There is currently no testcase for the reported problem. It's broken by design ;-) The reported problem occurs because the namespace resolving is done in pageresolve (used in resolving links), not in cleanID (which is used in getID). The proper fix is probably adding a pageresolve call to the getID function.
-
2006-12-01
gb
Chris, yes the checks are those which are expected.
Following Andi's suggestion, here is an other way to achieve it, changing getID function in a similar manner to what is done on links inside pages.
diff -r 6d63446808c6 inc/pageutils.php
--- a/inc/pageutils.php Mon Nov 27 22:33:56 2006 +0000
+++ b/inc/pageutils.php Thu Nov 30 23:57:40 2006 +0100
@@ -52,6 +52,23 @@ function getID($param='id',$clean=true){
//strip leading slashes
$id = preg_replace('!^/+!','',$id);
}
+
+ if(substr($id,-1) == ':'){
+ if(@file_exists(wikiFN($id.$conf['start']))){
+ // start page inside namespace
+ $id = $id.$conf['start'];
+ }elseif(@file_exists(wikiFN($id.noNS(cleanID($id))))){
+ // page named like the NS inside the NS
+ $id = $id.noNS(cleanID($id));
+ }elseif(@file_exists(wikiFN($id))){
+ // page like namespace exists
+ $id = $id;
+ }else{
+ // fall back to default
+ $id = $id.$conf['start'];
+ }
+ }
+
if($clean) $id = cleanID($id);
if(empty($id) && $param=='id') $id = $conf['start'];
-
2007-01-19
gb
Andi, do you want to commit that patch? Have you tested the suggested change?
-
2007-01-25
gb
Calling resolve_pageid from within getID also allows using namespace links from the requested URL. I'm sending the patch to the list if anyone wants to test it.
-
2007-01-25
gb
-
2007-03-13
gb
New patch sent to the list
-
2007-04-22
andi
fixed in devel