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
On Fri, 22 Oct 2004, Tom Insam wrote:
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?
I also prefer the first. If backwards compatibility with existing cgi scripts is a priority, I suggest having the formatters construct their own URLs if a node_prefix is given, and ask CGI::Wiki for one otherwise.
Justin
On Fri 22 Oct 2004, Tom Insam tom@jerakeen.org wrote:
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.
CGI/Wiki.pm doesn't do any actual CGI and I don't want it to start having to care about how the information it spits out is output.
I think what you want is an extension of the node_name_to_node_param and node_param_to_node_name methods in CGI::Wiki::Formatter::UseMod - see also the make_internal_link (etc) methods in there.
Kake
On Oct 26, 2004, at 5:44, Kake L Pugh wrote:
On Fri 22 Oct 2004, Tom Insam tom@jerakeen.org wrote:
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.
CGI/Wiki.pm doesn't do any actual CGI and I don't want it to start having to care about how the information it spits out is output.
I think what you want is an extension of the node_name_to_node_param and node_param_to_node_name methods in CGI::Wiki::Formatter::UseMod
- see also the make_internal_link (etc) methods in there.
This would be a solution, if we could nail down that api and say 'all formatter modules will provide these methods'. However, I don't like it - if I change formatters to one that doesn't support my linking style, I don't want to have all my links change. What the links look like is a completely seperate problem from how we turn wiki text into HTML.
tom
On Tue 26 Oct 2004, Tom Insam tom@jerakeen.org wrote:
if I change formatters to one that doesn't support my linking style, I don't want to have all my links change. What the links look like is a completely seperate problem from how we turn wiki text into HTML.
I think what you're saying is that you want one "thing" that does all the wiki formatting apart from the links, and another "thing" that does the formatting of the links, and you want to be able to use any all-formatting-but-the-links formatter with any does-the-links formatter.
Is that right?
Kake
On Oct 26, 2004, at 9:30, Kake L Pugh wrote:
On Tue 26 Oct 2004, Tom Insam tom@jerakeen.org wrote:
if I change formatters to one that doesn't support my linking style, I don't want to have all my links change. What the links look like is a completely seperate problem from how we turn wiki text into HTML.
I think what you're saying is that you want one "thing" that does all the wiki formatting apart from the links, and another "thing" that does the formatting of the links, and you want to be able to use any all-formatting-but-the-links formatter with any does-the-links formatter.
Yes.
With the exception that I don't like the word 'formatting' when applied to links. We're not formatting the links, we're creating a link.
tom
Given that:
On Tue, 26 Oct 2004 05:44:51 +0100, Kake L Pugh kake@earth.li wrote:
CGI/Wiki.pm doesn't do any actual CGI
When we gonna do this get-together to do the grand-rename? Next year? This weekend? :D
regards, Martin.