Last modified: 2006-04-15 14:51:16 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T2531, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 531 - Request new variables for {{NAMESPACE_TALK}} and {{NAMESPACE_NO_TALK}}
Request new variables for {{NAMESPACE_TALK}} and {{NAMESPACE_NO_TALK}}
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Templates (Other open bugs)
unspecified
All All
: Normal enhancement with 3 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2004-09-19 16:05 UTC by Alan Barrett
Modified: 2006-04-15 14:51 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
added variables (2.27 KB, patch)
2005-04-09 17:36 UTC, Florian Filz
Details

Description Alan Barrett 2004-09-19 16:05:28 UTC
Templates used in an article sometimes want to refer to the associated 
talk page.  Templates used om a talk page sometimes want to refer to the 
associated non-talk page.  It's impossible for template designers to do 
this correctly without making unportable assumptions.

To refer to the talk page, a template could use something like [[Talk:
{{PAGENAME}}]], but that fails if the target should really have been 
[[Wikipedia talk:{{PAGENAME}}]] or [[Template talk:Pagename]], etc.  It 
could use [[{{NAMESPACE}} talk:{{Pagename}}]], and this probably works 
for all namespaces in the English wikipedia, but not in other languages.

To refer to the non-talk page from a talk page, a template could use 
[[{{PAGENAME}}]], but this works only in the main namespace.  See [[en:
Template:Todo]] and [[en:Template:WikipediaTodo]] for a pair of 
templates that are identical except for having to work around this 
problem.

New variables that allowed us to say [[{{NAMESPACE_TALK}}:{{PAGENAME}}]] 
and [[NAMESPACE_NO_TALK}}:{{PAGENAME}}]] would be helpful, and should be 
easy to implement.  NAMESPACE_TALK would have to get the namespace as a 
numeric value, then set least significant bit (via something like "$ns 
|= 1;"), and convert the result from a numeric to a string namespace.  
NAMESPACE_NO_TALK would be much the same, except it would clear the 
least significant bit (via something like "$ns &= ~1;").
Comment 1 Wil Mahan 2004-10-12 17:01:06 UTC
(In reply to comment #0)
> Templates used in an article sometimes want to refer to the associated 
> talk page.  Templates used om a talk page sometimes want to refer to the 
> associated non-talk page.  It's impossible for template designers to do 
> this correctly without making unportable assumptions.

Templates that need to refer to the talk page, and are used
in more than one namespace, seem pretty rare. For every page,
the sidebar already has a link to the associated talk or non-talk
page, which should reduce the need for another link.

> To refer to the talk page, a template could use something like [[Talk:
> {{PAGENAME}}]], but that fails if the target should really have been 
> [[Wikipedia talk:{{PAGENAME}}]] or [[Template talk:Pagename]], etc.  It 
> could use [[{{NAMESPACE}} talk:{{Pagename}}]], and this probably works 
> for all namespaces in the English wikipedia, but not in other languages.

Why not?
Comment 2 Alan Barrett 2005-02-06 14:49:22 UTC
(In reply to comment #1)
> (In reply to comment #0)
> > could use [[{{NAMESPACE}} talk:{{Pagename}}]], and this probably works 
> > for all namespaces in the English wikipedia, but not in other languages.
> 
> Why not?

I know I replied to this months ago, but my reply doesn't appear.  Weird.

Proof by example should be good enough:  In finnish, the equivalent of "Talk" is "Keskustelu",
the equivalent of "Template" is "Template", but the equivalent of "Template talk" is "Template 
talk", not "Template keskustelu".  Also, the finnish equivalent of "Wikipedia" is "Wikipedia", 
but the equivalent of "Wikipedia talk" is "Keskustelu Wikipediasta", not "Wikipedia 
keskustelu" or "Wikipedia talk".
Comment 3 Josh Cogliati 2005-02-06 18:03:09 UTC
You don't need any new variables.  This can be defined with the software as is.  

How to do it:

First: create a normal template:
{{NAMESPACE_TALK}}

Then define the template as:
{{namespace_talk_for_{{NAMESPACE}}}}

Next, is the tricky part.  I would recommend going to the talk page for the
NAMESPACE_TALK, and putting the following in it:

{{namespace_talk_for_}}

{{namespace_talk_for_{{subst:ns:1}}}}

{{namespace_talk_for_{{subst:ns:2}}}}

{{namespace_talk_for_{{subst:ns:3}}}}

{{namespace_talk_for_{{subst:ns:4}}}}

{{namespace_talk_for_{{subst:ns:5}}}}

{{namespace_talk_for_{{subst:ns:6}}}}

{{namespace_talk_for_{{subst:ns:7}}}}

{{namespace_talk_for_{{subst:ns:8}}}}

{{namespace_talk_for_{{subst:ns:9}}}}

{{namespace_talk_for_{{subst:ns:10}}}}

{{namespace_talk_for_{{subst:ns:11}}}}

{{namespace_talk_for_{{subst:ns:12}}}}

{{namespace_talk_for_{{subst:ns:13}}}}

{{namespace_talk_for_{{subst:ns:14}}}}

{{namespace_talk_for_{{subst:ns:15}}}}

Once you have saved that, then you can define each of the 16 templates.
For example:
{{namespace_talk_for_}} should be defined to be Talk, and 
{{namespace_talk_for_Talk}} should be defined to be Talk, and 
{{namespace_talk_for_User}} should be defined to be User_talk, and 
so on and so forth.  

Then, when the template {{NAMESPACE_TALK}} is expanded in the main namespace, it
will expand to {{namespace_talk_for_}} which will expand to Talk, but when 
{{NAMESPACE_TALK}} is expanded in the User namespace, it will expand to 
{{namespace_talk_for_User}} which will expand to User_talk.

So, now you can do things like: [[{{NAMESPACE_TALK}}:{{PAGENAME}}]] and it will
work (as long as you properly defined all the sub namespace variables). 

The only signifcant advantage of doing it as a real variable are that you save
defining a bunch of template variables (34 to be exact, per wikimedia
installation), and it automatically works for all the wikipedias.   
Comment 4 Florian Filz 2005-04-08 23:43:59 UTC
(In reply to comment #3)
> So, now you can do things like: [[{{NAMESPACE_TALK}}:{{PAGENAME}}]]

Linking works perfectly with this workaround, however nesting does not.

Take for example the {{TODO}}-template: 
Todo-lists should be saved as sub-entries in the discussion namespace, 
so that there only can be a unique todo-list for each entry.

I want to import the items of the todo-list using
   {{{{NAMESPACE_TALK}:{{PAGENAME}}/to_do}} 
which evaluates to 
   {{{{NAMESPACE_TALK}:Pagename/to_do}} 
instead of 
   ===================================
   * Create NAMESPACE_TALK variable
   * Create NAMESPACE_NO_TALK variable
   * Item 3 to do
   ===================================
Comment 5 Florian Filz 2005-04-09 17:36:14 UTC
Created attachment 412 [details]
added variables

simply added the variables NAMESPACE_TALK and NAMESPACE_NO_TALK to 
includes/Parser.php
includes/MagicWords.php
languages/Language.php
Comment 6 lɛʁi לערי ריינהארט 2005-05-19 02:49:44 UTC
Halló!
I tried to rebuild [[en:Template:To do]] at
http://jadesukka.homelinux.org:8180/betawiki/Malline:Task

At [[en:Template:To do]] I identified the following problems:
- it does not use inline links for the "Image" and "Category" namespaces
- it place the "to do" pages in the NAMESPACE_NO_TALK namespace; this generates
errors in the image namespace and makes no sense for category namespace; acces
to the special namespace is limited anyway
- it references only to the NAMESPACE_NO_TALK page either from NAMESPACE_NO_TALK
or NAMESPACE_TALK but does not reference "from outside" i.e. from another
namespaces or pages

It was a hard job to implement a version which:
- emulates an extension <inline> ... </inline> for this particular case,
- use an "alternate table" to define the location of the "to do" pages which is
mainly required tor image, category, special but also for (main) and Mediawiki
namespaces
- allows to share the content from different locations
- creates an alternative body to display the image for the image namespace
- is "portable" to other languages (up to the point where "localurl" fails using
non 7 bit charavtes in parameters)
- provides a priority managment feature and a category management to handle a
great amount of "to do pages"

Please do not ask about the amount of objects to emulate the required IF  ELSIF
 ELSE END or CASE ... statements or doubling parameters because of the lack of
an <underscores> ... </underscores> extension.

The lack of variables as NAMESPACE_TALK or NAMESPACE_NO_TALK or GENERICNAMESPACE
or many other required features does NOT prevent from being less MediaWiki safe.
It only makes the development of new applications more painfull and more complex.

I was surprised about the new resptrictions encountered with "localurl" which I
did not expect. I suggest that it should be improuved / fixed with common efforts.

Best regards Reinhardt
]] user:gangleri [[
Comment 7 Dave Miller (ProgMania) 2005-09-03 20:14:45 UTC
I find this very useful, and it would only take 5 minutes for someone to add it to CVS!

In 1.5rc4, I changed Parser.php and Language.php the same as in the diff file (although manually). Since new 
constants have been added to MagicWord.php, I had to change the two constant values in MagicWord.php, and the 
position in the file. I also added them to $wgVariableIDs, although I don't know what that's for.
Comment 8 Tietew 2006-04-15 09:12:12 UTC
{{TALKSPACE}} and {{SUBJECTSPACE}} have been checked into SVN.
Should this bug be closed?
Comment 9 bdk 2006-04-15 14:51:16 UTC
just a note for interested people, please look up SVN to see what was added exactly: 
http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/MagicWord.php?view=log#rev13612
Thanks Rob \o/

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links