syntax to transclude a page without the containing page inheriting categories, interlanguage links
OpenPublic

Description

Author: aliter

Description:
Short: On http://en.wikipedia.org/wiki/Category:Fruit
the Plantanos demo shows up. We'd like to avoid that.

At
http://meta.wikimedia.org/wiki/Help:Template#Redirection
is description of a template as a "redirect". However, on
the same page
<http://meta.wikimedia.org/wiki/Help:Template#A_category_ta
g_in_a_template.3B_caching_problem> mentions that the
categories are inherited when a page/template is include
in this way. And indeed, the example of Plantanos has a
category fruit
http://en.wikipedia.org/wiki/Category:Fruit, which is
polluted by the Planatos Demo. Apparently, to stop this
from occuring, we'd have to stop the inheritence of the
categories for the including page.

On nl: we have a
http://en.wikipedia.org/wiki/Wikipedia:TourBusStop
bustour project
<http://nl.wikipedia.org/wiki/Wikipedia:TourBus_-
_Bushalte_Wikipedia_NL>, that we would like to implement
similar to such redirects, since that's the only way we
can find that doesn't require modifying the original page.
However, we can't do that if it'll cause the busstops to
appear in the categories.
Our intended purpose does not require any specific
implementation. A NOCAT keyword, a
{{_nocat_|normaltemplate}} meta-template, or a
{{normaltemplat|_nocat_}} standard-argument would all
suffice.


Version: 1.4.x
Severity: enhancement

bzimport added a project: MediaWiki-Categories.Via ConduitNov 21 2014, 7:01 PM
bzimport added a subscriber: wikibugs-l.
bzimport set Reference to bz835.
bzimport created this task.Via LegacyNov 6 2004, 5:30 PM
bzimport added a comment.Via ConduitNov 19 2004, 1:31 AM

rowan.collins wrote:

I'm not quite sure what it is you're trying to achieve here - for the first one,
why not just use a real redirect? And for the second, what is the content that
you are trying to include from where, and what is the "original page" that you
are trying not to modify?

This is asking for the same feature as bug 706, so I'm going to close it as
duplicate, but feel free to clarify what you're trying to do, in case it
requires something more (or less) than that.

*** This bug has been marked as a duplicate of 706 ***

bzimport added a comment.Via ConduitNov 20 2004, 5:03 PM

aliter wrote:

(In reply to comment #1)

I'm not quite sure what it is you're trying to achieve here

Sorry this was not clear from the links given:

Tourbusses are basically reading-lines. They have a starting-page and each page
to read has, minimally, a link to the next page to read. If we were to do this
by changing the actual encyclopedia pages, those visitors who were not following
the lines would see curious links telling them:
"Next on the Bluewater Line: [[Dime]]".

The Dutch Wikipedia wants to avoid this. A solution to this would be to make a
separate busstop-page for each busstop, eg. Nickel/Busstop. That busstop-page
would then contain:
"{{:Nickel}} -- Bluewater Line -- Next Stop: [[Dime/Busstop]]".

This way a separate level of navigation is created for tourbusses, as only those
reading the busstop-pages would actually see the tourbus navigation.

  • for the first one, why not just use a real redirect?

A redirect would not do as this would put the reader on the actual page, which
should not have the navigation.

And for the second, what
is the content that you are trying to include from where, and what is
the "original page" that you are trying not to modify?

The content we are trying to include is the encyclopedic content of a normal
Wikipedia page. That page, the original page, is included completely in the
busstop page by way of a template. That way the on the busstop page the page
text and the navigation is visible, while at the original page just the text is.
Unfortunately, both show up in the categories the original page is in.

This is asking for the same feature as bug 706, so I'm going to close
it as duplicate, but feel free to clarify what you're trying to do,
in case it requires something more (or less) than that.

Originally they weren't that related, but the remaining difference is now: In
our case the templates are actual Wikipedia pages.

  • An implementation based on the Templates namespace is not a direct solution.
  • An implementation that switches off the categories for the template (page)

itself would not help us.

  • An implementation that doesn't work for the template (page) itself, would

still work for us.

Implementing request Bug 450, would also allow a solution to our problem, though
I do not care for that idea nor for that solution.

bzimport added a comment.Via ConduitDec 2 2004, 7:49 PM

bugzillas+padREMOVETHISdu wrote:

Clarification of the distinction between bug 706 and bug 835:

(The new syntax proposed below is just an example and might be ugly. I don't
intend to propose that we use this syntax.)

bug 706:

  1. [[azbycxdw]] has the normal syntax:

{{delete}}.

  1. [[Template:Delete]] has some new syntax like:

[[Category:Candidates for speedy deletion|Template:Delete|no_cat]]

In this case [[[Category:Candidates for speedy deletion]] lists
[[Template:Delete]] but not [[azbycxdw]].

bug 835:

  1. [[dime]] has the normal syntax:

[[Category:Currency]]

  1. [[dime/bus stop]] has some new syntax like:

{{:dime|no_cat}}

In this case [[Category:Currency]] lists [[dime]] but not [[dime/bus stop]].

bug 450 offers a (good|bad) solution for bug 706, but not for bug 835 (since
both pages are in the article namespace).

BTW in bug 706 comment 8, case 1 is what is being discussed at bug 706 and case
2 is what is being discussed at bug 835, but for the fact that case 2 of bug 706
comment 8 seems to deal only with transclusion of a page in Template: namespace
but bug 835 attempts to deal with the transcluded page being in any namespace.

bzimport added a comment.Via ConduitDec 2 2004, 7:59 PM

bugzillas+padREMOVETHISdu wrote:

Of course I meant:

bug 706:

  1. [[azbycxdw]] has the normal syntax:

{{delete}}.

  1. [[Template:Delete]] has some new syntax like:

[[Category:Candidates for speedy deletion|Template:Delete|no_cat]]

In this case [[[Category:Candidates for speedy deletion]] LISTS [[azbycxdw]] but
DOES NOT LIST [[Template:Delete]].

Sorry for any confusion.

bzimport added a comment.Via ConduitDec 6 2004, 5:37 PM

aliter wrote:

The bug stops can be implemented in various ways. Bug 835 in a bug
450-implementation would be possible, eg:

  1. [[dime]] has the normal syntax:

[[Category:Currency]]

  1. [[Wikipedia:dime (bus stop)]] has normal syntax:

{{:dime}}

In this case [[Category:Currency]] lists [[dime]] under Articles, but it lists
[[Wikipedia:dime (bus stop)]] under Policy and meta-documents. That is, the bus
stops no longer polute the Articles categories; instead, they polute a different
section. (Bug 450 does not fulfill the requests bug 706 and bug 835; it just
puts their unintended listings in a less prominent location.)

bzimport added a comment.Via ConduitDec 16 2004, 12:42 PM

rowan.collins wrote:

I realised the summary was actually saying the wrong thing, because it implied
the syntax would be in the template:
[OLD:] "category syntax such that the page the syntax is in IS categorized but
other pages transcluding it AREN'T"
What we want is syntax to go in the *containing* page that prevents it
inheriting categories from "templates" (by which I mean transcluded pages,
whether or not they're in the Template: namespace)
[NEW:] "syntax to transclude a page without the containing page being categorised"

Note that bug 1110, which I'm going to mark as a dupe of this, suggests
NOTEMPLATECAT, which is slightly different from any of my suggestions at bug
706 comment 8, in that it would presumably allow directly entered
"[[Category:Foo]]" to categorise the page. I'm not sure, however, how easy this
would be with the current structure of the code, because I think transclusion
are just "folded in" before any other parsing of things like categories is done,
so there's no way of the parser knowing whether a particular link was
transcluded or is in the "real" page.

bzimport added a comment.Via ConduitDec 16 2004, 12:46 PM

rowan.collins wrote:

*** Bug 1110 has been marked as a duplicate of this bug. ***

bzimport added a comment.Via ConduitDec 16 2004, 7:19 PM

bugzillas+padREMOVETHISdu wrote:

(In reply to comment #6)

Note that bug 1110, which I'm going to mark as a dupe of this, suggests
NOTEMPLATECAT, which is slightly different from any of my suggestions at bug
706 comment 8, in that it would presumably allow directly entered
"[[Category:Foo]]" to categorise the page. I'm not sure, however, how easy this
would be with the current structure of the code, because I think transclusion
are just "folded in" before any other parsing of things like categories is done,
so there's no way of the parser knowing whether a particular link was
transcluded or is in the "real" page.

Any solution to this bug requires some processing during the "folding in" before
parsing other things. How about inserting "special" delimiters for start & end
of template text while "folding in" and letting the parser handle these regions
specially later on?

e.g. "foo {{templ}} bar" is currently replaced by "foo contents of
Template:templ bar". Instead replace it with "foo {{contents of Template:templ}}
bar". When the parser sees the "{{" (unless it is within <nowiki>) it'd know it
is processing code from within a template (Apart from this, it ignores the
"{{"). It remembers it is within the template until it reaches the *MATCHING* "}}".

If "foo {{nocat|templ}} bar" is used, the parser sees "foo {{nocat|contents of
Template:templ}} bar". After the "{{nocat|", category tags are ignored until the
*MATCHING* "}}".

bzimport added a comment.Via ConduitDec 16 2004, 8:20 PM

rowan.collins wrote:

(In reply to comment #8)

e.g. "foo {{templ}} bar" is currently replaced by "foo contents of
Template:templ bar". Instead replace it with "foo {{contents of Template:templ}}
bar". When the parser sees the "{{" (unless it is within <nowiki>) it'd know it
is processing code from within a template (Apart from this, it ignores the
"{{"). It remembers it is within the template until it reaches the *MATCHING*

"}}".

In some ways, this *would* be a sensible approach, but unfortunately the current
parser isn't really a parser, and doesn't work in a "sequential" manner of that
kind. It mainly consists of global pattern-matching substitutions, or splitting
the entire page into sections beginning with each occurrence of a particular
pattern (e.g. links are dealt with by splitting the text on every occurrence of
"[[").

So anything involving "process differently from here ... up to here" has to
involve processing that section seperately, and then re-assembling things
afterwards. And we can't do that with templates without breaking the way people
use them: e.g. "{{template w/ start of table}} {{template w/ middle of table}}
{{template w/ end of table}}" only works because the parser does the
substitutions *before* looking at the table syntax.

This is why I suggested in bug 706 comment 8 that NOCAT was very easy but
rather inflexible. The only way I can think of doing the other suggestions
("NOTEMPLATECAT", "<nocat></nocat>", and even "{{nocat:foo}}") would be to
go through and delete everything matching "[[Category:.*]]" in the affected bit
of text before the replaceInternalLinks() function has a chance to spot them.
Being careful, of course, to do so *after* all "<nowiki></nowiki>" sections have
been hidden from the parser.

Perhaps in Parser::braceSubstitution() [which handles the actual transclusion]
we could add something like:
if($no_inherit_cats) { <remove anything that looks like a Category tag> };
somewhere just after "$text = $this->strip( $text, $this->mStripState );"

This is still rather awkward, because it means writing a function specifically
for spotting [[Category:Foo]], which will presumably need its own check to
exclude [[:Category:Foo]] (that's normally dealt with by the link substitution
function, and I'm not sure Title.php will reliably tell the difference)

Apologies for the above being a) an odd mix of "beginner's guide" and "technical
overload" and b) a bit of a stream of conciousness. I may try hacking up a patch
in a moment.

bzimport added a comment.Via ConduitDec 16 2004, 8:34 PM

bugzillas+padREMOVETHISdu wrote:

So anything involving "process differently from here ... up to here" has to
involve processing that section seperately, and then re-assembling things
afterwards. And we can't do that with templates without breaking the way people
use them: e.g. "{{template w/ start of table}} {{template w/ middle of table}}
{{template w/ end of table}}" only works because the parser does the
substitutions *before* looking at the table syntax.

I didn't understand you. Of course, the substitutions must be done *before*
looking at the table syntax. That's how it is even if my approach is
implemented. Probably what I meant was that after the "fold in all templates"
pass, there should be a pass for "handle categories within {{...}}" and only
after that everything else should be done. Any problems with this approach still?

bzimport added a comment.Via ConduitDec 16 2004, 9:05 PM

rowan.collins wrote:

(In reply to comment #10)

[...] Probably what I meant was that after the "fold in all templates"
pass, there should be a pass for "handle categories within {{...}}" and only
after that everything else should be done. Any problems with this approach still?

The problem I was originally thinking of was that we can't just say "oh, we've
come upon a <nocat> tag, don't process categories until we reach the </nocat>
tag" because the parser doesn't go through the text in order like that. (Which
was what you seemed to imply in comment 8: "...remembers it is within the
template...") It's more like "first, we deal with all the transclusions in the
entire text; next, we do all the italics and bold in the entire text; next, we
do all the internal links in the entire text; etc" [that order may not be right,
BTW]

But thinking about it, we can still replace every section matching "<nocat> ...
</nocat>" with its contents after [[Category:*]] tags have been removed. As in:
preg_replace ($text, "<nocat>(.*)</nocat>", "remove_category_tags($1)"); - no
"remembering we're inside", but roughly the same result. Which may or may not
make more sense than doing it just *before* dumping the template's content into
the article, I'm not sure. Still requires a function that spots and removes
Category tags, though.

bzimport added a comment.Via ConduitDec 18 2004, 7:37 PM

bugzillas+padREMOVETHISdu wrote:

(In reply to comment #5)

In this case [[Category:Currency]] lists [[dime]] under Articles, but it lists
[[Wikipedia:dime (bus stop)]] under Policy and meta-documents. That is, the bus
stops no longer polute the Articles categories; instead, they polute a different
section. (Bug 450 does not fulfill the requests bug 706 and bug 835; it just
puts their unintended listings in a less prominent location.)

Hey, we totally forgot about the uglier problem -- A page listing templates (&
transcluding each of them) gets all the categories the individual templates
refer to (e.g. [[Wikipedia:Template messages/All]]). And this problem is not
addressed by bug 450.

bzimport added a comment.Via ConduitDec 18 2004, 7:39 PM

bugzillas+padREMOVETHISdu wrote:

(In reply to comment #12)

Hey, we totally forgot about the uglier problem -- A page listing templates (&
transcluding each of them) gets all the categories the individual templates

I meant lists all these categories at the top/bottom/(wherever acc. to the skin).

refer to (e.g. [[Wikipedia:Template messages/All]]). And this problem is not
addressed by bug 450.

bzimport added a comment.Via ConduitFeb 23 2005, 1:03 PM

rowan.collins wrote:

*** Bug 1576 has been marked as a duplicate of this bug. ***

bzimport added a comment.Via ConduitMar 4 2005, 1:36 PM

flamurai wrote:

Syntax suggestion:

{{disp:template}}

"disp" stands for "display", since the primary purpose of this is to display the
template only, not have it be included in categories. This is consistent with
the "subst" modifier. I think it's best to be consistent here rather than invent
new syntax.

brion added a comment.Via ConduitMar 13 2005, 12:25 AM
  • Bug 1691 has been marked as a duplicate of this bug. ***
bzimport added a comment.Via ConduitMar 27 2005, 1:27 PM

bugzillas+padREMOVETHISdu wrote:

(In reply to comment #16)

> *** Bug 1691 has been marked as a duplicate of this bug. ***

Just like the containing page not inheriting category tags, some want it not to
inherit interlanguage links. This allows interlanguage links to be used on
template pages to track templates doing the same thing in different language-wikis.

Probably just like a NOTEMPLATECAT we could have a NOTEMPLATEINTERLANG
or just like a {{foo|no_cat}} we could have a {{foo|no_cat|no_interlang}} or
just like a {{no_cat:foo}} we could have a {{no_cat:no_interlang:foo}} (For some
reason the third option looks promising w.r.t. creating new problems...)

brion added a comment.Via ConduitJun 6 2005, 1:18 AM
  • Bug 2338 has been marked as a duplicate of this bug. ***
bzimport added a comment.Via ConduitAug 22 2005, 6:41 PM

rowan.collins wrote:

Tim Starling has apparently coded a feature which fits this bug - a
"<noinclude>" tag.
See http://mail.wikipedia.org/pipermail/wikitech-l/2005-August/031123.html

bzimport added a comment.Via ConduitOct 2 2005, 4:08 PM

gangleri wrote:

compare with

bug 706: syntax such that a (template) page can be un-categorized, but still
categorise pages transcluding it

bzimport added a comment.Via ConduitMar 15 2006, 2:13 AM

Wiki.Melancholie wrote:

(In reply to comment #19)

... <noinclude>[[Category:Fruit]]</noinclude> ...

Resolving this bug as FIXED.

bzimport added a comment.Via ConduitMar 15 2006, 2:39 AM

gangleri wrote:

(In reply to comment #21)

Resolving this bug as FIXED.

There are still some issues with nested templates:
<noinclude>...</noinclude> works only one level. This complicates template design.
See: http://epov.org/wd-gemet/index.php/Template:User_he

It did not make sense to include <noinclude>...</noinclude> in Template:User_lang:
http://epov.org/wd-gemet/index.php?title=Template%3AUser_lang&diff=392268&oldid=392032

Requesting that the code between <noinclude> and </noinclude> would not
transclude in the template namspace but in anything else is probably another
request / option.

best regards reinhardt [[user:gangleri]]

bzimport added a comment.Via ConduitJun 16 2006, 6:19 PM

aliter wrote:

I'm quite surprised to see this bug closed. On closer inspection I find this was
because of the implementation of - syntax for a page to allow transcluding it
without the containing page inheriting categories, interlanguage links - which
is close, but no cigar.

To use the solution given here, we'd have to drop the original requirement that
the orginal, transcluded page is not modified for the sake of the bus stop.
Implementing it this way, the next editor to come along would wonder why there
was a noinclude on that page, and possibly remove it.

Or for the case of a template: to use this solution means a non-selective
choice: if something, eg. a category, should not be included for a certain page
then it's never included.

~~~~

bzimport added a comment.Via ConduitJun 21 2006, 1:24 AM

robchur wrote:

*** Bug 4407 has been marked as a duplicate of this bug. ***

bzimport added a comment.Via ConduitJun 21 2006, 1:40 AM

ayg wrote:

We appear to have about four suggested options here.

  1. When called: <nocat>{{template}}</nocat>
  2. When called: {{nocat:template}}
  3. On caller page: NOCAT
  4. In template: [[Category:Catname|Exclude:listofpagenames]]

3 is much too inflexible, and 4 scales terribly. I would suggest option 2,
since it will in almost all cases be shorter to type than 1 and anyway fits with
what we currently have; it should preferably be combinable with existing subst:,
etc., although this is noncritical.

I would suggest the feature not automatically exclude interlanguage links,
however; they're different enough that they don't deserve to be lumped in with
categories. (If anything, they should *never* be transcluded.)

(Note: removed testme, since the feature has obviously not been added.)

bzimport added a comment.Via ConduitJun 22 2006, 8:54 AM

rotemliss wrote:

I also support option 2.

bzimport added a comment.Via ConduitJun 30 2006, 3:53 PM

omniplex wrote:

The original issue of 4407 was "template lists". A simple
trick allows this: {{{category|[[Category:target-cat]]}}}

The example usage of template {{X}} in list Y would add Y
to target-cat. But {{X|category=}} doesn't.

bzimport added a comment.Via ConduitJun 30 2006, 5:34 PM

ayg wrote:

(In reply to comment #27)

The original issue of 4407 was "template lists". A simple
trick allows this: {{{category|[[Category:target-cat]]}}}

The example usage of template {{X}} in list Y would add Y
to target-cat. But {{X|category=}} doesn't.

Sure, but that's hacky, confusing, and requires a lot more user-end maintenance
(does *this* template have the hack working yet? how about *this* one? oh, this
needs {{edit protected}} . . .). A software solution would be much better.

bzimport added a comment.Via ConduitJul 17 2006, 6:33 PM

ayg wrote:

*** Bug 6720 has been marked as a duplicate of this bug. ***

bzimport added a comment.Via ConduitJul 17 2006, 6:35 PM

ayg wrote:

*** Bug 6293 has been marked as a duplicate of this bug. ***

brion added a comment.Via ConduitMay 2 2007, 6:16 PM
  • Bug 9763 has been marked as a duplicate of this bug. ***
Sj added a comment.Via ConduitJan 30 2008, 6:50 AM

I agree with Simetrical's latest statements, in particular,

"(If anything, they should *never* be transcluded.)"

And note that this bug is closely related to #167.

bzimport added a comment.Via ConduitOct 12 2008, 6:35 PM

rowan.collins wrote:

*** Bug 15941 has been marked as a duplicate of this bug. ***

Mr.Z-man added a comment.Via ConduitOct 12 2008, 7:05 PM

(In reply to comment #25)

We appear to have about four suggested options here.

  1. When called: <nocat>{{template}}</nocat>
  2. When called: {{nocat:template}}
  3. On caller page: NOCAT
  4. In template: [[Category:Catname|Exclude:listofpagenames]]

    3 is much too inflexible, and 4 scales terribly. I would suggest option 2, since it will in almost all cases be shorter to type than 1 and anyway fits with what we currently have; it should preferably be combinable with existing subst:, etc., although this is noncritical.

    I would suggest the feature not automatically exclude interlanguage links, however; they're different enough that they don't deserve to be lumped in with categories. (If anything, they should *never* be transcluded.)

    (Note: removed testme, since the feature has obviously not been added.)

How would {{subst:nocat:template}} work? Would it just work as if the categories were wrapped in <noinclude> and not add them in the wikitext where its subst'd? <nocat>{{subst:template}}</nocat> seems like it would make more sense for this, as the result of substitution would just be the entire page text wrapped in <nocat>, which should still work as expected (preventing the categories from working) until the <nocat> tags are removed.

bzimport added a comment.Via ConduitOct 12 2008, 7:12 PM

ayg wrote:

Reasonable point. <nocat> might be the better idea.

Cenarium added a comment.Via ConduitOct 12 2008, 10:52 PM

<nocat> seems to be the best option. There are different cases to consider though.

Sandboxes, draft pages, etc should not show up in categories. However, they should show the categories at the bottom of the page so that new users see how it works.

In maintenance pages and for certain other applications, the page should not show up in categories and also be removed from the bottom of the page.

So we need two tags:
<nocat> that removes the page from wrapped categories (including transcluded ones) but let them visible on the page.
<hidecat> that hides the wrapped categories on the page (including transcluded ones) but let the page categorized in them.

bzimport added a comment.Via ConduitOct 12 2008, 11:51 PM

bugs wrote:

I think I like {{nocat:...}} better than <nocat>. Semantically, the concept "transclude this page, but don't transclude categories" sounds very much like a sub-option of transclusion, rather than a whole separate operation.

How would {{subst:nocat:template}} work?

Logically, it would do an in-place expansion of the template, and every template reference transcluded would have "nocat:" inserted. For example:

Page 1:

Testing.

{{subst:nocat:Page 2}}

Page 2:

I am transcluded.
{{stub}}

[[Category:Transcluded pages]].

Stub:

This page is a stub.

[[Category:Stubs]]

Page 1 would be saved as:

Testing.
I am transcluded.

{{nocat:stub}}

The alternative proposed above would lead to Page 1 being saved as:

Testing.
<nocat>
I am transcluded.
{{stub}}

</nocat>

Advantages of <nocat>:

  • You can do <nocat>[[Category:Foo]]</nocat>, which seems, um, pointless.
  • You can do <nocat>{{template1}}, {{template2}}</nocat>. Is this useful? Do we often want to transclude multiple pages, and ensure that none of their categories apply? This is probably only useful on pages that serve as lists of templates, and there would be other solutions, like creating a {{tpl-nocat}} template or something.

Advantages of {{nocat:...}}:

  • Semantically cleaner.
  • Uses less characters (for a single transclusion, anyway).

As for <hidecat>, is this really needed? We have HIDDENCAT, so <hidecat> would mean "transclude page X, and although page X is in some categories which aren't normally hidden, hide them anyway". Can you give an example why this is useful?

bzimport added a comment.Via ConduitOct 13 2008, 12:21 AM

bugs wrote:

I just read #36 more closely:

<nocat> that removes the page from wrapped categories (including transcluded ones) but let them visible on the page.

Eep. I thought <nocat> would mean "Don't transclude categories at all". Sounds like we need four distinct ways of transcluding categories:

  • Normal: Add page to category, show on page.
  • Nocat: Don't add page to category, or show on page.
  • Hidecat: Add page to category, but don't show on page.
  • ??? (nogroup?): Don't add page to category, but show on page.

Obviously these are two independent flags (hide/show, categorise/don't categorise), but I don't know if that would be more useful.

Steve

Mr.Z-man added a comment.Via ConduitOct 13 2008, 12:32 AM

(In reply to comment #37)

Page 1 would be saved as:


Testing.
I am transcluded.
{{nocat:stub}}


Except that's inconsistent with how everything else works. If you subst one page onto another, you get *exactly* what's on that page, minus anything wrapped in <noinclude>, this would be transcluding something different.

And what happens if you have something like

{{subst:nocat:template1}}

where template1 consists of:

{{<includeonly>subst:</includeonly>template2}}

and template2 is something complicated like

{{#ifeq:{{NAMESPACE}}|{{TALKSPACE}}|This template should not be used on talk pages|[[Category:{{#ifeq:{{NAMESPACE}}|{{ns:6}}|Files|Content}} using template2]]}}

<nocat> would still work the same, but {{nocat:}} gets somewhat convoluted, and I'm sure I could find a lot more complex examples on enwiki.

bzimport added a comment.Via ConduitOct 13 2008, 12:45 AM

bugs wrote:

Except that's inconsistent with how everything else works. If you subst one

page onto another, you get *exactly* what's on that page, minus anything
wrapped in <noinclude>, this would be transcluding something different.

That's not a convincing argument. Subst always works the same way because it doesn't have any options. Adding an option of course violates the principle that it always behaves the same way: that's why you have options.

And what happens if you have something like

<snip>

<nocat> would still work the same, but {{nocat:}} gets somewhat convoluted

That is a convincing argument.

{{nocat:subst:...}} seems mildly cleaner semantically, but would (I think) be a real bitch to code, for the reasons given here, so probably isn't worth it.

So, can we agree on:

  • <nocat>...</nocat>: no categories that appear between the start/end tag, whether by transclusion, substitution, or otherwise, will be shown on the page, or have the page grouped in them
  • <hidecat>...</hidecat>: page is grouped in any categories, but not shown.
  • <???>...</???>: cats are shown, but no grouping (need a name for this)

Also, what happens when:

  • a page that contains some <nocat>...</nocat> or <hidecat>...</hidecat> is itself transcluded? I guess the simplest rule would be that once hidden, categories remain hidden. Best not to implement a <showcat> or something then.
bzimport added a comment.Via ConduitOct 13 2008, 6:08 PM

ayg wrote:

nocat: looks like it would be a pain to implement, so <nocat> seems like the better choice, yes. Having to find all templates and so on in the source code and add nocat: before each invocation would be a pain, and it wouldn't even necessarily work if some non-template construct adds a category as a side effect.

Question: if some construct with <nocat> around it adds the page to [[Category:Pages with too many expensive parser function calls]], or [[Category:Hidden categories]], or some similar thing, should that be suppressed? My inclination would be not.

As for <hidecat>, what would the use-case be for that again? We already have HIDDENCAT; why would we want to hide the category from some pages and not others? It sounds like it could be chaotic.

And <???> seems completely strange, outright deceptive in fact. If a category is listed, the page should be in the category. That's the point of the category list, not to serve as some kind of list of arbitrary categories that the current page may or may not be in.

bzimport added a comment.Via ConduitOct 13 2008, 6:26 PM

happy_melon wrote:

Wouldn't it make more sense for 'suppressed' categories to show up as internal links, in the same way that image inclusions 'suppressed' by the bad image list are converted into (admittedly usually nonsensical) links? This strikes me as a similar concept. I agree that there seems to be very little use for <hidecat>.

bzimport added a comment.Via ConduitOct 13 2008, 6:46 PM

ayg wrote:

(In reply to comment #42)

Wouldn't it make more sense for 'suppressed' categories to show up as internal
links, in the same way that image inclusions 'suppressed' by the bad image list
are converted into (admittedly usually nonsensical) links? This strikes me as a
similar concept.

The use-cases here are things like "include a template into a page that lists templates, while not including its categories, since those are meant for where it's actually used". In such cases you clearly don't want links being randomly scattered about the place, you want it to display as it usually does (just not categorize).

bzimport added a comment.Via ConduitOct 13 2008, 9:57 PM

bugs wrote:

And <???> seems completely strange, outright deceptive in fact.

I agree. The use case was for sandbox pages, but I don't think it's compelling.

So, all in favour of implementing <nocat>, and leaving the others until there is some serious demand for them?

bzimport added a comment.Via ConduitOct 14 2008, 10:50 AM

davidg wrote:

I see that there are good reasons both to show and not show the "disabled" categories in the category footer box at the bottom of the page. To show them would be confusing for instance on the pages under [[Wikipedia:Template messages]]. But would be good when testing templates in sandboxes.

So I did a little thinking: If you have enabled to see hidden categories in your settings, then they are shown on a second line in the category footer box prefixed by the text "Hidden categories:". The disabled categories could be listed in the same way, say prefixed by the text "Disabled categories:".

And to avoid anyone misunderstand what I mean: I think the disabled categories should always be shown like that, there is no need for an option to hide them. Since if they are prefixed like that they are no longer confusing.

I would like if the "disabled categories" list were surrounded by a div tag with some id and class so we can style them, for instance to use smaller text.

bzimport added a comment.Via ConduitOct 14 2008, 11:35 AM

bugs wrote:

As far as I understand, this comment #45 just debates whether or not to display the <nocat>'ed categories, without regard to whether or not to implement <nocat>.

If you have enabled to see hidden categories in your settings, then they are shown on a second line in the category footer box prefixed by the text "Hidden categories:". The disabled categories could be listed in the same way, say prefixed by the text "Disabled categories:".

To clarify, I think by "hidden category" you mean any category that has HIDDENCAT in its page text, and by "disabled category", you mean any category *reference* that is not parsed because it is ultimately surrounded in a <nocat>...</nocat> tag.

I think the disabled categories should always be shown like that, there is no need for an option to hide them.

Is there a benefit? The <nocat> tag would be there to avoid spurious category links being formed or shown. If "hidden" categories can be shown, it's because the page really *is* in that category. But the page is *not* in a "disabled" category. I don't see the value of displaying it.

bzimport added a comment.Via ConduitOct 14 2008, 12:00 PM

happy_melon wrote:

A list of which categories have been suppressed on a page would be invaluable for both debugging and abuse-monitoring. Perhaps they should be listed with the other 'metadata' on the edit page?

bzimport added a comment.Via ConduitOct 14 2008, 1:34 PM

davidg wrote:

(In reply to comment #46)

As far as I understand, this comment #45 just debates
whether or not to display the <nocat>'ed categories,

Correct. But yes, I would find the <nocat> </nocat> tags very useful. And <nocat> would be much more useful than the other suggested methods.

To clarify, I think by "hidden category" you mean any category
that has HIDDENCAT in its page text, and by "disabled category",
you mean any category *reference* that is not parsed because it
is ultimately surrounded in a <nocat>...</nocat> tag.

Correct.

> I think the disabled categories should always be shown like that,
> there is no need for an option to hide them.

Is there a benefit? The <nocat> tag would be there to avoid
spurious category links being formed or shown. ...
... I don't see the value of displaying it.

There are two issues here:
1: To avoid that a page gets put in a category by a template only displayed, discussed or tested on a page.
2: To avoid making users think that the page has been categorised when it has not been categorised.

And two usage cases:

1: Templates often do pretty advanced category magic. Thus we need to test and show that category magic. Thus we need to see what categories the template causes, even on test pages. But preferably without the page actually getting categorised. And that means we can leave such demonstrations "forever" without the demonstration page showing up in the category.

2: On pages such as the pages under [[Wikipedia:Template
messages]] on the English Wikipedia, where lots of templates are demonstrated, we also don't want the templates to categorise the page. And ideally we wouldn't want to see the categories there. But more importantly we don't want users to think that the page has been categorised.

Thus if we list the "disabled categories" separately, prefixed by "Disabled categories:" we fulfil all our needs at once. (Albeit it is a compromise.)

The next step could be to make a magic word that makes the "Disabled categories:" list not show at the bottom of the page. Thus the same <nocat> </nocat> tags can be used on such a page, making things simpler both for the users of those tags and for the MediaWiki coders. But such a magic word is not especially necessary, it would just be a luxury.

bzimport added a comment.Via ConduitOct 18 2008, 3:09 PM

rowan.collins wrote:

I think the 2 separate use cases would be best served by 2 separate features:

(1)
Requirement: For demonstrating templates or other convoluted syntax that would normally categorise a page, such as on an instruction page or list of templates.

Proposed solution: <nocat>...</nocat> construct that strips all [[Category:...]] links out of the text it surrounds, so that the page is not added to any of the categories mentioned, and those categories are not displayed in any way.

(2)
Requirement: For testing templates, category syntax, etc, such as on a sandbox or tutorial.

Proposed solution: UNCATEGORISED, which would stop the entire page being added to any categories, but continue to show the "Categories:" list at the bottom of the page.

We could have an additional note saying something like "This page is not actually included in any categories, but would be included in the following:"

The advantage of having UNCATEGORISED at the page level is that it could be included in {{Please leave this line alone (sandbox heading)}} and similar, whereas simply opening a <nocat> section would rely on no-one closing it prematurely.

It would even allow one to test the <nocat> feature on the sandbox, since [[Category:Foo]]<nocat>[[Category:Bar]]</nocat> would show only "Foo" in the list of categories at the bottom of the page.

bzimport added a comment.Via ConduitNov 4 2008, 5:53 AM

aliter wrote:

Just to confirm:
A <nocat>...</nocat> construct would fulfil our original request.

Cenarium added a comment.Via ConduitNov 16 2008, 10:55 PM

To summarize, I think we need:
*A global magic word DECATEGORIZE that removes the page from all categories, but still displays them as normal at the bottom of the page.
*A tag <decat> </decat> that removes the page from all wrapped categories, but still displays them as normal at the bottom of the page.
*A tag <nocat> </nocat> that removes the page from all wrapped categories, and remove them from the bottom of the page.

Uses:
*DECATEGORIZE (used with the intermediary of a template {{DECATEGORIZE}} like HIDDENCAT) could be used, essentially, for the thousands of sandboxes and draft pages that pollute categories and related changes. However, for convenience and especially in the interest of newbies, it's better to display categories on the page.
*<decat> would be used, for example, for [[WP:AFC]] pages, that are categorized by the [[Template:AFC submission]], but that shouldn't include categories added by the user as part of the proposed article.
*<nocat> would be used for many maintenance pages that transclude templates temporarily or indefinitely and hence add themselves to categories.

DECATEGORIZE, though less flexible, has several advantages on <nocat> : it's searchable, it's global so cannot be canceled out like <nocat>, it's cleaner for global use. It also seems to be the easiest to compute, and the most needed.

bzimport added a comment.Via ConduitNov 16 2008, 11:15 PM

bugs wrote:

*A tag <decat> </decat> that removes the page from all wrapped categories, but

still displays them as normal at the bottom of the page.

*A tag <nocat> </nocat> that removes the page from all wrapped categories, and

remove them from the bottom of the page.

This naming isn't going to work - "decat" and "nocat" sound totally synonymous to me. At least "hidecat" refers to the visual effect.

*A global magic word DECATEGORIZE that removes the page from all

categories, but still displays them as normal at the bottom of the page.

The more I think about this, the more it seems of limited use. Even a page that primarily includes other pages is likely to want to be categorised in some categories of its own. So it might be better as a "from this point on" tag.

But, anyway, there is a lot of consensus for a nocat and hidecat/decat tag. Is there a formal process for requesting that it be implemented?

Steve

bzimport added a comment.Via ConduitNov 17 2008, 12:00 AM

ayg wrote:

(In reply to comment #52)

But, anyway, there is a lot of consensus for a nocat and hidecat/decat tag. Is
there a formal process for requesting that it be implemented?

Yes, file a bug. If that doesn't get it done quick enough, either find some developers to nag about it or write the functionality yourself.

bzimport added a comment.Via ConduitDec 7 2008, 11:07 PM

aliter wrote:

"File a bug"? Like bug 835, opened: 2004-11-06 17:30 UTC, you mean? Oops, it seems I forgot the anniversary cake again. Well, maybe on the fifth anniversary.

bzimport added a comment.Via ConduitDec 7 2008, 11:35 PM

ayg wrote:

Yes. Sorry if I wasn't clear, my point is that there is a formal process and it has been followed (since this bug was in fact filed). The formal process that exists will not guarantee that your bug gets fixed -- there's not enough developer manpower out there for that to be possible. Further progress on this will require someone to do some coding. If you aren't willing or able to do that, you're going to have to try to get other people to, one way or another; there's no formal process for doing that beyond what's already been done.

bzimport added a comment.Via ConduitJan 18 2009, 2:21 AM

jopiswezggzmw wrote:

nocat: implementation

This patch allows the {{nocat:}} functionality. If a template is called by being prefixed with nocat: it ignores the categories in the template.

Not sure how optimal this implementation is but it works.

attachment nocat.patch ignored as obsolete

bzimport added a comment.Via ConduitJan 22 2009, 1:41 PM

jopiswezggzmw wrote:

Parser tests

Attached: nocat.parserTests.txt

bzimport added a comment.Via ConduitJan 22 2009, 1:53 PM

jopiswezggzmw wrote:

Parser tests 2

Due to bug 17100 these tests have to be split up and can't be integrated into the main parserTests.

Attached: parserTests.nocat.txt

werdna added a comment.Via ConduitJan 26 2009, 12:51 AM

+ if ($nocats ) {
+ $text = preg_replace('/\[\[category:.*?\]\]/i','',$text);
+ }

That isn't very elegant.

bzimport added a comment.Via ConduitJan 26 2009, 1:02 AM

ayg wrote:

It will fail at least in the case of foreign languages and extra whitespace (the latter is trivial to correct, though). And possibly other things as well, although I can't think of them. This very much seems like the wrong approach overall. But don't ask me what the right one is, I have no idea.

Cenarium added a comment.Via ConduitFeb 3 2009, 3:42 PM

It cannot handle pages with dynamically transcluded templates and would be difficult to use for sandboxes and draft pages, which is almost all the use for this on enwiki (we have thousands, see for example [[Wikipedia:Database reports/Polluted categories]]).

There is only <nocat> ... </nocat> that can handle this, and <decat> ... </decat> for demonstration/new user pages such as sandboxes, articles for creation...

I think the names are different enough, nocat for No Category, and decat for decategorize. DECATEGORY and NOCATEGORY are not especially needed if we have the tags.

Cenarium added a comment.Via ConduitFeb 4 2009, 5:10 PM

Another concern with categorization due to templates that may be addressed by nocat tags are user css or js. They are sometimes incorrectly categorized, for example see [[en:Category:Wikipedia pages with incorrect protection templates]].

bzimport added a comment.Via ConduitJul 10 2009, 1:21 AM

aliter wrote:

A tag <decat> </decat> that keeps the page out of all wrapped categories, but does display such categories, would satisfy our original request.

A global magic word DECATEGORIZE that keeps the page out of all
categories, but does display them, would too, in theory. In practice, however, it would prevent us from categorising the busstop pages in e.g. a [[Category:Busstops]]. I suggest this alternative be dropped.

A tag <nocat> </nocat> that keeps the page out of all wrapped categories, and doesn't show such categories either, would also satisfy our original request. The differences with decat are a trade-off issue, and might depend on the specific audience of a busstop.
For the naming similarity, this one could be <nocats> instead, assuming that name isn't in use for some other function as yet.

~~~~

bzimport added a comment.Via ConduitDec 19 2010, 1:56 PM

karmelakarmela wrote:

By help pages illustrating the output of templates would be nice a tag <nocat> </nocat> that keeps the page out of all wrapped categories.

Gustronico added a comment.Via ConduitFeb 8 2011, 4:51 PM

I suggest these magic word names, excuse me for my English:

  1. NOTRANSCLUDEDCATS and NOTRANSCLUDEDINTERWIKIS to block all transcluded stuff on a given page, or

An alternative solution may be:

  1. NOCATSABOVE and NOINTERWIKISABOVE to block all categories and interwikis (be them written or trancluded) appearing *before* the magic word itself in the wikitext, but accepting those appearing (as usually) at the end of the page.

{{transcluded page with its own cats being blocked}}
NOCATSABOVE
[[category for this page]]

Bawolff added a comment.Via ConduitDec 31 2011, 6:53 AM

-keyword need-review, +keyword reviewed per comment 53.

A no category transclusion method should work on a deeper level than just regexing out the categories from the input text.

Bawolff added a comment.Via ConduitDec 31 2011, 11:42 AM

Created attachment 9788
Add {{nometa:some templat|arg1|arg2|....}} syntax to disable transcluding categories and interlanguage links

Hmm, this is difficult to do, since the category/interlanguage links are expanded after templates are expanded. Maybe the new parser work would make doing such things easier (I'm not paying attention at all to whats happening with that stuff, so I have no idea if it'd change things or not).

The best way of implementing this I could think of:
*Save all the interlangs and categories
*Parse the template (in a recursiveTagParse type of way), and put it in the page at right spot
*Reset the interlangs/categories to the way they were before doing that.

So this patch adds a new parser func that looks more like its modifying the template call then being an actual parser func. It looks like {{nometa:Some template|args...}} (I didn't use a hash to make it look like int:, raw:, msgnw: etc).

Personally I like the name nocat: better, but nometa: is more generic in terms of applying to interlanguage links too. One minor issue is that it also stops tracking categories. I also wasn't sure if it should deal with {{DISPLAYTITLE:}}, {{DEFAULTSORTKEY:...}}, NOTOC, etc. As it stands, my patch lets those types of behaviour switches through.

It feels mildly icky to save and reset parts of the parser output, and I'm generally just nervous about things that touch the parser (Although this doesn't directly touch it really), hence I'm posting this as a patch instead of directly committing. (as an aside, if its decided this approach isn't an acceptable solution, this can trivially be turned into an extension for those who really want it).

So, thoughts?

Attached: diff.patch

Krinkle added a comment.Via ConduitJan 1 2012, 10:50 PM

Since it looks like this is not going to be a trivial feature to implement, perhaps it's better worth the time to invest in bug 167 (storing meta data outside of wiki page contents and versioning it separately) - which would make this bug 835 redundant and also prevents making the syntax more complicated.

Bawolff added a comment.Via ConduitJan 1 2012, 11:04 PM

(In reply to comment #68)

Since it looks like this is not going to be a trivial feature to implement,
perhaps it's better worth the time to invest in bug 167 (storing meta data
outside of wiki page contents and versioning it separately) - which would make
this bug 835 redundant and also prevents making the syntax more complicated.

bug 167 imho has its own issues which make it more complicated then this one. Most people on that bug don't even agree what they want the feature to look like (Everything from including hot cat in core, to fully having the cats out of wiki text is suggested). There's issues with how conditional inclusion would work (which is not a feature I could imagine the Wikipedian's wanting to give up).

werdna removed a subscriber: werdna.Via WebDec 10 2014, 6:19 PM

Add Comment

Column Prototype
This is a very early prototype of a persistent column. It is not expected to work yet, and leaving it open will activate other new features which will break things. Press "\" (backslash) on your keyboard to close it now.