Mailing List Archive

Proposed change in wiki links
I propose that if a link like [[foo]] is processed for output, and
article foo doesn't exist but category foo does, then the link should be
treated like [[:Category:foo|foo]]. The former is a lot easier to write.

This will make it hard to create an article foo if category foo already
exists. I'm not sure that's a bad thing. If someone does manage to do
that, then all [[foo]] links will switch from category to article. But
these are the only drawbacks I can see.

The code is very simple. In the place in Skin.php:makeLinkObj() where
it checks if the article ID is 0 and makes a broken link, use this code
instead:

$aid = $nt->getArticleID() ;
if ( 0 == $aid ) {
#New stuff starts here...
$ttext = $nt->getText() ;
$cname = Namespace::getCanonicalName(Namespace::getCategory());
$cnt = Title::newFromText ( $cname.":".$ttext ) ;
if (0 == $cnt->getArticleID()) {
$retVal = $this->makeBrokenLinkObj( $nt, $text, $query, $trail,
$prefix );
} else {
$retVal = $this->makeKnownLinkObj( $cnt, $text, $query, $trail,
$prefix );
} else { #...

Is this the right place to propose this kind of change?

Chris

--
Chris Phoenix cphoenix@CRNano.org
Director of Research
Center for Responsible Nanotechnology http://CRNano.org
Re: Proposed change in wiki links [ In reply to ]
On Mon, 27 Sep 2004 00:21:14 -0400, Chris Phoenix <cphoenix@crnano.org> wrote:
> I propose that if a link like [[foo]] is processed for output, and
> article foo doesn't exist but category foo does, then the link should be
> treated like [[:Category:foo|foo]]. The former is a lot easier to write.
>
> This will make it hard to create an article foo if category foo already
> exists. I'm not sure that's a bad thing. If someone does manage to do
> that, then all [[foo]] links will switch from category to article. But
> these are the only drawbacks I can see.

I think this would be a *very* bad idea; categories are often named
very similarly to valid articles, and while a policy could be made of
not doing so ([[Category:History topics]] not [[Category:History]];
[[Category:Types of toy]] not [[Category:Toys]]) this seems like a
rather dubious thing to enshrine in the software. Having links that
magically change target (and thus don't show up as non-existent) would
*only* be a good idea if the plain target was *never* going to be a
desired name. I don't think [[Category:Foo]] vs [[Foo]] gives such a
guarantee.

--
Rowan Collins BSc
[IMSoP]
Re: Proposed change in wiki links [ In reply to ]
I guess it depends on whether you want categories to be second-class
citizens, or whether you want to build your site around them. For my
site, I'm choosing the second option. For a site that already has lots
of articles and categories with the same name, it may not be a good option.

The plain target might be a desired name, but it would not be an
accessible name. Once the category was created, the only way to create
the article would be hand-editing a URL. And in fact, even that would
be easy to prevent.

I'm not sure it's good to have articles and categories with the same
name anyway. It'd be easy for an author to lose track of which one they
were intending to point to. I think I've just convinced myself that I
should disallow articles and categories with the same name, period. And
then there's no reason not to use the [[foo]] syntax for both.

So I'll withdraw the proposal qua proposal, but I still think it's cool
for what I'm doing.

Chris

Rowan Collins wrote:

> On Mon, 27 Sep 2004 00:21:14 -0400, Chris Phoenix <cphoenix@crnano.org> wrote:
>
>>I propose that if a link like [[foo]] is processed for output, and
>>article foo doesn't exist but category foo does, then the link should be
>>treated like [[:Category:foo|foo]]. The former is a lot easier to write.
>>
>>This will make it hard to create an article foo if category foo already
>>exists. I'm not sure that's a bad thing. If someone does manage to do
>>that, then all [[foo]] links will switch from category to article. But
>>these are the only drawbacks I can see.
>
>
> I think this would be a *very* bad idea; categories are often named
> very similarly to valid articles, and while a policy could be made of
> not doing so ([[Category:History topics]] not [[Category:History]];
> [[Category:Types of toy]] not [[Category:Toys]]) this seems like a
> rather dubious thing to enshrine in the software. Having links that
> magically change target (and thus don't show up as non-existent) would
> *only* be a good idea if the plain target was *never* going to be a
> desired name. I don't think [[Category:Foo]] vs [[Foo]] gives such a
> guarantee.
>

--
Chris Phoenix cphoenix@CRNano.org
Director of Research
Center for Responsible Nanotechnology http://CRNano.org