[cgi-wiki-dev] Creating URLs
Tom Insam
cgi-wiki-dev@earth.li
Fri, 22 Oct 2004 22:57:14 +0100
I need a canonical, wiki-wide way of turning a node name into an URL.
Right now, in CGI::Wiki::Kwiki, the formatter does it one way, the
'list all pages' page does it another way, and the 'converting back
from passed url to node name' code lives in yet a third place. This is
totally crazy.
The formatter modules all need a way of turning a node name into an url
for embedding in <a> tags. The wiki code itself will need to turn node
names into urls for linking from various other places. I'd like my Node
object to know what their own urls are. And preferably I'd like the
code that turns a name into an url to live in the same source file as
the code that takes a passed CGI request parameter and turns it into a
node name. Thus it seems to make sense to put this code into
CGI/Wiki.pm itself.
This will, alas, entail great change on the part of the formatters.
Specifically, we'll have to no longer pass node-prefix, etc, to the
formatters, but instead have them call back to CGI::Wiki when they need
a link for a node. Is this going to be possible? The alternative is to
have the formatters provide a 'linkify this node name' method, which is
much less elegant, but much simpler.
Both methods will require new releases of all formatter modules. I
prefer the first one, naturally, because it's more elegant, but it will
break existing code, whereas merely adding a method will let legacy
stuff keep going. Do people have opinions, thoughts, etc?
tom