![]() | This is an archive of past discussions. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page. |
Archive 1 |
I am currently designing a template that will make category suppression very simple and mostly automatic. When I have coded, tested and documented the template I will do as I always do: Wait some time before I start to use it, to give others proper time to test it and suggest improvements.
There are probably more usage cases than I know about, so here are some of my thoughts so far, so we can discuss them:
1: I am thinking of calling it {{cat handle}}.
2: The most basic usage will be like this:
{{cat handler| [[Category:Somecat1]][[Category:Somecat2]] }}
3: The default should be to categorise in most namespaces, except those where templates are often just demonstrated or listed and thus should normally not categorise. Thus it will categorise in main, file, help, category and portal space. But it will not categorise in talk, user, wikipedia and template space. So most templates that use {{cat handler}} can probably use the basic syntax above.
4: With some simple parameters one can tell it what namespaces one want it to categorise in. And one will be able to feed different categories for different namespaces, if needed. The parameters will perhaps be similar to how {{ namespace detect showall}} works. See example at point 7 below.
5: It will use a blacklist placed on say "Template:cat handler/blacklist". Pages and page types that should not have categories can be listed there, like for instance the subpages of Wikipedia:Template messages and "/archive" pages. If a template that uses {{cat handler}} is placed on a blacklisted page, then the template will not add any categories. The blacklist will use pattern matching on the pagenames, so the specification will look something like this:
/archive* = hide Wikipedia:Template messages/* = hide
For its pattern matching it will use the meta-template {{ if pagename}} which is very efficient. Category suppression is one of the reasons why I created {{if pagename}}.
6: {{cat handler}} will of course understand the "nocat" parameter. But since it will have the blacklist, in most cases users will not need to use the "nocat" parameter.
7: Here is the full syntax for a really complex usage case:
{{cat handler | 1 = [[Category:Somecat1]][[Category:Somecat2]] | 2 = [[Category:Somecat3]] | 3 = [[Category:Somecat4]] | main = 1 <!--Already default, this line not really necessary--> | help = 2 | user = 2 | talk = <!--No categories on talk pages--> | other = 3 | nocat = {{{nocat|}}} }}
I know how to code the above. But I am not sure if that is the syntax I will use. I am investigating several other ways to specify what namespaces to categorise in. I'm trying to make it more user friendly, but still not causing too nasty code inside {{cat handler}}.
8: I can add the option to feed pagename patterns to {{cat handler}}, so that it can be made to categorise or not categorise on specific groups of pages. Similar to how {{ if pagename}} works. This is for individual templates, while the blacklist sets the default for all usage of {{cat handler}}. Here's an example:
{{cat handler | 1 = [[Category:Somecat1]][[Category:Somecat2]] | /doc = <!--No categories on /doc pages--> | /archive* = 1 <!--Categorise on archives, even if they are blacklisted--> | other = 1 <!--Categorise in all namespaces, but not on blacklisted pages--> | nocat = {{{nocat|}}} }}
But I hope that is not needed, since it would make the documentation of {{cat handler}} scary.
I'd love any feedback about what functionality this template needs.
-- David Göthberg ( talk) 13-14 November 2009 (UTC)
Since
Willscrlt asked me to explain more, below are some examples how templates could be using {{
cat handler}}. The examples show the full code for those templates. Note that these new examples use a slightly improved syntax compared to the explanations in my message above, since I now have figured out how to make {{cat handler}} handle that.
Example 1:
{{ambox | text = This is some message box used on articles. }}{{cat handler | [[Category:Somecat1]] }}<noinclude> {{documentation}} <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude>
Since the category for the above box is fed to {{cat handler}}, that box will only categorise when in main, file, help, category and portal space. It might seem silly that it categorises in all those namespaces, but an article template is hardly ever placed in those namespaces. But it will not categorise in talk, user, wikipedia and template space. And that is good, since in those namespaces most templates are just demonstrated or listed, not used.
The simple syntax shown above can be used for templates meant for any of the namespaces main, file, help, category and portal. Thus covering most of the templates we use. But for templates meant for talk, user, wikipedia or template space, see the examples below.
Example 2:
{{tmbox | text = This is a talkpage message box. }}{{cat handler | talk = [[Category:Somecat2]] <!--Only categorise in talk space--> | nocat = {{{nocat|}}} <!--So "nocat=true" works--> }}<noinclude> {{documentation}} <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude>
The above box will only categorise in talk space. But it will not categorise on /archive pages since they are blacklisted. That is, {{cat handler}} has an "/archive* = hide
" rule in its blacklist. And if you need to demonstrate (discuss) that box on a talkpage, then you can feed "nocat=true" to prevent that template from categorising, like this:
== My new template == Hey guys, have you seen my new talkpage template? {{mytemp|nocat=true}} Nice, isn't it? --~~~~
Example 3:
{{ombox | text = This is a box for the top of WikiProject or Guideline pages or similar. }}{{cat handler | wikipedia = [[Category:Somecat3]] <!--Only categorise in wikipedia space--> | nocat = {{{nocat|}}} <!--So "nocat=true/false" works--> }}<noinclude> {{documentation}} <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude>
The above box will only categorise in wikipedia space. It will not categorise on "Wikipedia talk:" pages. And it will not categorise on for instance
Wikipedia:Template messages/Wikipedia namespace that lists such templates, since that page is blacklisted. That is, {{cat handler}} has a "Wikipedia:Template messages/* = hide
" rule in its blacklist. And if you need to demonstrate that box on another page in wikipedia space, then you can feed "nocat=true" to prevent that template from categorising. But we hardly ever demonstrate such boxes on other wikipedia space pages, so the "nocat = {{{nocat|}}}
" line in that box is not especially needed, so it doesn't matter much if the template programmer forget to add that line.
If you need the box to categorise when on a blacklisted page, then simply feed "nocat=false" to skip the blacklist check. Note that this will not cause the box above to categorise on for instance a talk page, it will just cause categorisation in namespaces for which it has data.
Example 4:
{{mbox | text = This is a box used in several namespaces. }}{{cat handler | main = [[Category:Somecat1]][[Category:Somecat2]] | 1 = [[Category:Somecat3]] <!--For help and user space--> | help = 1 | user = 1 | talk = <!--No categories on talk pages--> | other = [[Category:Somecat4]] <!--For all other namespaces--> | nocat = {{{nocat|}}} <!--So "nocat=true/false" works--> }}<noinclude> {{documentation}} <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude>
In the above example we use a numbered parameter to feed one of the categories, and then we tell {{cat handler}} to use that numbered parameter for both the help and user space.
Example 5:
{{mbox | text = This is a box used in all namespaces. }}{{cat handler | other = [[Category:Somecat1]] <!--Categorise in all namespaces, but not on blacklisted pages--> | nocat = {{{nocat|}}} <!--So "nocat=true/false" works--> }}<noinclude> {{documentation}} <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude>
The above example will categorise in all namespaces, but not on blacklisted pages. If you feed "nocat=true" it will not categorise. And if you feed "nocat=false" it will categorise even on blacklisted pages.
-- David Göthberg ( talk) 17:52, 14 November 2009 (UTC)
Ok. It is making more sense to me now. Thanks! :-)
End, messages moved here from Wikipedia talk:Category suppression. -- David Göthberg ( talk) 04:57, 15 November 2009 (UTC)
{{mytemp | othercat = [[Category:Some other cat]] }}
{{mytemp | nocat = true }} [[Category:Some other cat]]
{{ambox | text = This is the "mytemp" box. }}{{#if:{{{othercat|}}} | {{{othercat|}}} | {{cat handler | [[Category:The mytemp cat]] | nocat = {{{nocat|}}} <!--So "nocat=true/false" works--> }} }}<noinclude> {{documentation}} <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude>
{{ambox | text = This is the "mytemp" box. }}{{cat handler | [[Category:The mytemp cat]] | nocat = {{{nocat|}}} <!--So "nocat=true/false" works--> | othercat = {{{othercat|}}} }} }}<noinclude> {{documentation}} <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude>
{{cat handler | [[Category:Somecat]] }} {{cat handler | 1 = [[Category:Somecat]] }}
{{cat handler | 1 = [[Category:Somecat]] <!--Categorise in the default namespaces--> | wikipedia = 1 <!--And also in wikipedia space--> | nocat = {{{nocat|}}} }}
{{cat handler | 1 = [[Category:Somecat]] | wikipedia = 1 <!--Only categorise in wikipedia space--> | other = <!--Don't categorise in the other namespaces--> | nocat = {{{nocat|}}} }}
{{cat handler | 1 = [[Category:Somecat]] <!--Categorise in the default namespaces--> | main = <!--But not in main space--> | wikipedia = 1 <!--But add wikipedia space--> | nocat = {{{nocat|}}} }}
{{cat handler | user = [[Category:Somecat1]] <!--Categorise in user space--> | talk = {{talkspace detect | user = [[Category:Somecat1]] <!--And in user talk space--> }} | nocat = {{{nocat|}}} }}
{{cat handler | 2 = [[Category:Somecat1]] | user = 2 <!--Categorise in user space--> | talk = {{talkspace detect | user = 2 <!--And in user talk space--> }} | nocat = {{{nocat|}}} }}
2. {{
cat handler}}
works for me. Just as a funny aside (since you mention English is not your native language--though you could have fooled me!), with computers, I often mention a particularly difficult task is like "herding cats" or "wrangling cats". I guess that "cat handler" is somewhat similar to "cat wrangling or herding" ("to herd", "to wrangle", and "to handle" are all similar in meaning in English). That was a long explanation to let you know that the new name makes me smile every time I read it. :-)
1a. At this time, I don't see the need to implement overrides as long as the work-around is documented (so that people like me who try to make things more complicated are shown the easier route to take instead).
1b and 3. Ok. That makes sense. I've just been customizing some templates and ran into issues where the attribute names from one were reused in another using the same names, but for slightly different purposes. It made tracking the logic between different templates a bit tricky. It would have been nice if they had used the same name for the same thing or else distinguished between the different uses somehow. But, since there is already a well-established standard, let's stick with that. At least it sounds like they are all being used for the same thing, and that's good!
4. Ok. Cool.
5. Haha. Nice side effect. That's what most software developers would call a "feature" (a bug that is documented isn't a bug, it's a feature!)
As to "Wikipedia" space vs. "Project" space… sorry. About half of my templating work is cross-wiki template development and conversion. I don't even think of it as the "Wikipedia" space, because on fr.wiki it's "Wikipédia" and on some of the others it is "Vikipedia" or something else. Then you have Commons"("Commons") and Meta ("Project"), and so on. I always refer to it internally (in my brain) as Project space. I know that confuses more en.wiki-centric people, because they think of Projects as WikiProjects. *shrug* I suppose that's how it is with people from the U.S. always thinking that "American" means from the U.S., instead of being from the Americas (Brazilians are Americans, too, of course).
One of the main reasons I use "Project" instead of "Wikipedia" in my template development is that it is one fewer thing that has to be localized (or rather "un-localized" back to the generic) when I move a template to another language or project. I'm hoping that {{
cat handler}}
will port fairly easily. It will be nice to use it on Meta and other projects.
6. Wow! That last example is awesome. You have a really great mind for twisted logic puzzles. No wonder you are interested in cryptography. I'll take your word that distinguishing between talk spaces is not significant. But it's nice to know that there is an example of how to use it.
Perhaps there should be two doc pages. "Basic instructions" and "advanced tips". The basic instructions should be clear and easy for beginners. The Advanced tips could be just a collection of odd/complex examples like you have shown here. Then whenever someone brings up an unusual implementation, it can be added to the tips for future reuse. Better than reinventing the wheel. And, it doesn't overwhelm the average user.
Looks great. It will be a nice feature. And don't worry. I won't touch that template. I'm just working on establishing the related WikiProject for now. — Willscrlt ( “Talk” ) 08:33, 15 November 2009 (UTC)
{{cat handler| project = [[Category:Somecat]] }}
".I think as a general rule, templates should not wind up in the main category name space for categories that they include. I read through this but I don't think I saw any place where this action can be set as the default or can be optionally set other then through the old include only. Vegaswikian ( talk) 06:38, 20 November 2009 (UTC)
{{{1}}}
Are you sure it's a good idea to treat {{{1}}}
as a special case? It seems like it would avoid a lot of complicated explanation in the documentation if you used {{cat handler|default=[[Category:Something]]...}}
instead of {{cat handler|[[Category:Something]]...}}
/{{cat handler|1=[[Category:Something]]...}}
. (Of course, that would mean that you have to explicitly call default=
, instead of using the unnamed first parameter.)
Since {{cat handler}} is only likely to be used when constructing/updating other templates, I don't think there's any harm in removing the special case. Besides, by specifying default=
, you reinforce the idea that this is the default behaviour, and that other options are possible—that will remind editors of exactly what the template is going to do when they transclude it.
TheFeds
02:57, 22 November 2009 (UTC)
usertalk
, projecttalk
, etc.), so that you can prevent (for example) a user talk template from doing anything in file talk space. Also, there should be an explicit option all
for categorizing in all namespaces (for the rare situations where that's desirable).
TheFeds
03:04, 22 November 2009 (UTC){{cat handle|other=[[Category:Somecat]]}}
. When "other=" is used alone it looks a bit odd, but the name makes more sense if you see that it can also be used together with the other parameters, then it means "the other namespaces" as in "the rest of the namespaces". This is established naming for it from the namespace detection templates such as {{
namespace detect}} and {{
main other}}.{{cat handle|[[Category:Somecat]]}}
, and the template takes care of the rest. Forcing people to use a special parameter for the normal case that covers most templates would mean we loose the simplicity.other
, but it's not really the most obvious solution either. (Plus, the documentation wasn't clear whether other
with no additional parameters was intended to be used to mean the same thing as the proposed all
, or if it just conveniently provided that function.){{cat handler|default=[[Category:Something]]...}}
. They'll all have to consult the docs page at this point, so I don't think there's a major possibility for confusion. And this template will only be used occasionally in specialized contexts—because it's you only transclude it when you're editing another template—so there's not a huge advantage to providing the simplified syntax for the default case. In my view, the advantage of not having to deal with a special case when learning the template outweighs the small benefit of a short form for {{{1}}}
only.
TheFeds
16:27, 22 November 2009 (UTC){{cat handler | all = [[Category:Somecat]] <!--Categorize in all namespaces--> }} {{cat handler | main = [[Category:Somecat1]] <!--Categorize in main (article) space--> | talk = [[Category:Somecat2]] <!--Categorize in talk space--> }} {{cat handler | all = [[Category:Somecat1]] <!--Category for all namespaces--> | main = [[Category:Somecat2]] <!--But use this in main space--> | talk = <!--But no categories on talk pages--> }} {{cat handler | all = [[Category:Somecat1]] | main = [[Category:Somecat2]] | talk = }}
[[Category:Somecat1]] [[Category:Somecat2]]
". And it looks like for talk space the user simply didn't bother to feed any category, thus one would expect to get "[[Category:Somecat1]]
".I am planning to add one or two new parameters, and I would like some feedback on their naming and values. Here's a first example:
{{cat handler | [[Category:Somecat]] | subpage = no <!--Don't categorize on subpages--> }} {{cat handler | [[Category:Somecat]] | basepage = no <!--Don't categorize on basepages--> }}
I have just been testing to add {{ cat handler}} to some templates. (I just edited their /sandbox pages to use {{cat handler}} instead of their old categorization code.) I discovered that some templates don't want to categorize on subpages, for instance to avoid categorizing on /doc and /sandbox pages. And I know many of the Wikipedia space pages have subpages with the page header, and then we don't want templates to categorize on those header subpages. So I am thinking of adding a parameter (or two) so one can choose if this template will categorize on subpages or not. I don't know if there is any cases with the opposite, where one would only want to categorize on subpages, but we should probably support that case too when we are at it.
We could also use a single parameter to handle both cases. That would be convenient if a template wants to forward the parameter, since then only one parameter needs forwarding to do both things. But it causes slightly more complex values. Like this:
{{cat handler | [[Category:Somecat]] | subpage = no <!--Don't categorize on subpages--> }} {{cat handler | [[Category:Somecat]] | subpage = only <!--Don't categorize on basepages--> }} {{cat handler | [[Category:Somecat]] | subpage = {{{subpage|}}} <!--So "subpage=no/only" works--> }}
Adding this function to {{ cat handler}} is easy and fairly efficient. And if I do it right then it has additional benefits such as that the "page" parameter can be used to test also the basepage/subpage categorization of a template.
-- David Göthberg ( talk) 08:46, 24 November 2009 (UTC)
subpage=yes
, do the subpages too. Almost every template can be expected to have a /doc page, and many have /code and other subpages that aren't meant to be directly used. And usually, the category specifically refers to what the main template does, not to the function of the subpages.subpage=only
is a good feature.
TheFeds
17:07, 24 November 2009 (UTC)subpage=only
" and "subpage=no (or yes)
".subpage=yes
" option. (Note mostly to myself: Stopping all subpages should not be done from the blacklist, since then one would have to use "nocat=false
" which would cause categorizing on other unwanted pages too.)subpage=no/only
" option and documented it. For the reasons described above I choose the default to categorize in subpages. This is of course not set in stone. I still would like to hear what people think about the parameter and its naming etc.subpage=no/only
" check, then yes we get fewer code lines. But then {{basepage subpage}} would be called on every usage of this template, which costs database lookups and would cause more damage if someone does a bad edit to {{basepage subpage}}. So putting the call inside the "subpage=no/only
" check uses less resources and is more robust.This template is way too heavy. The ability to tell a template not to categorise is trivially implemented; all it requires is to wrap your categories in a single #if statement. But this template binds it up with all manner of rarely-needed functionality, making a great many pages unnecessarily heavy on the processor. It think it is a solution looking for a problem, and should be dumped. Hesperian 23:48, 29 November 2009 (UTC)
{{cat handler | main = [[Category:Somecat1]] <!--Categorize in main (article) space--> | talk = [[Category:Somecat2]] <!--Categorize in talk space--> | nocat = {{{nocat|}}} <!--So "nocat=true" works--> }}
Preprocessor node count: 165/1000000 Post-expand include size: 496/2048000 bytes Template argument size: 105/2048000 bytes Expensive parser function count: 0/500
Preprocessor node count: 237/1000000 Post-expand include size: 955/2048000 bytes Template argument size: 167/2048000 bytes Expensive parser function count: 0/500
nocat={{{nocat|}}}
" option and so on.Regarding the value 'h0#384!5nea+w9', I assume this is just a non-empty, never-be-used-as-a-parameter value. Can we use something better? I have a bot that really gets confused and many templates use the value '¬' in this case. Actually this template does too some lines above. Or is this some magic code that I'm missing? Hopperpl ( talk) 19:53, 29 November 2009 (UTC)
h0#384!5nea+w9
" is fed to one of the parameters. But that anyone would ever feed "h0#384!5nea+w9
" is exceedingly unlikely. (And it can never even be a category name since it lacks "[[Category:]]
" and it contains "#
" which can't be used in page names in MediaWiki.) There is no reason it should confuse your bot, since that value should never be fed to the template, it is only used internally. So your bot should never see that value.{{#ifeq: h0#384!5nea+w9 | {{{talk| {{{user| h0#384!5nea+w9 }}} }}} | <!--Both "talk" and "user" are undefined--> | <!--"talk" and/or "user" has data or is empty but defined--> }}
cagegory =
" parameter we have the option to feed "category = {{{category|¬}}}
". But ouch! You made me reread the code and study the category parameter. The backwards compatibility with "category =
" was added afterwards, since some users asked for it. But I see now that we have a parameter name collision. This template already used "category =
" to mean "don't categorize in category space". I have disliked that ugly "category = {{{category|¬}}}
" hack from starters, and now I see it collides with the name of the namespace, it is evil! Hopperpl: Thanks for making me find this bug. I have to ponder what to do with that.Thoughts on this? For example, ifexist "BASEPAGENAME/catno" it would not categorize, and ifexist "BASEPAGENAME/catyes" it would categorize. – xeno talk 16:21, 16 December 2009 (UTC)
yes
" or "no
" in it. Then the user himself can modify the value when needed, without having to ask an admin. (We can easily check the content of a subpage like that by using template code, we have already tested this for another template.)no
" in it.all no
" to prevent categorization on the page and all its subpages, or the value "subpages no
" to only prevent the subpages to categorize but not the page itself. (Or perhaps the shorter values "no+
" and "no*
", but that is perhaps to cryptic.) This could also be useful in other spaces than user space, although for the other spaces the blacklist already works well. And of course if we feed "nocat=false
" to a template it should not check the "/categorize" subpage just as "nocat=false
" overrides the blacklist.no
" is preventing categorization. ( {{Cat handler}} should not add that category when it suppresses categorization based only on namespace, since that is normal usage.) And on that category page I will put an explanation about why some pages don't show categories. That would give users a chance to figure out what is going on.Would it be possible to allow |nocat=yes
to work as well as |nocat=true
? Thanks. --
WOSlinker (
talk)
23:35, 6 January 2010 (UTC)
categorize=no
" since I find that clearer. But adding a new method probably is bad, so for now I prefer the old method "categories=no
" which {{cat handler}} already understands.{{
editprotected}}
Since there has been no opposition on
the technical village pump and the main page shouldn't be categorized by templates, could you add |Main Page=hide <!-- don't categorize the main page -->
to {{
Cat handler/blacklist}}? This edit would also reduce the harm of possible mistakes when someone mistakenly adds a template to the main page. --
The Evil IP address (
talk)
21:52, 2 June 2010 (UTC)
I think that the black list should also excempt the sandbox and related pages, e.g. {{ X1}} or {{ X2}}. Categorization there is often pointless. -- The Evil IP address ( talk) 19:13, 25 May 2010 (UTC)
![]() | This
edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Where it shows: | Wikipedia:Template messages/* = hide <!-- Don't categorise on its subpages --> | /archiv* = hide <!-- Don't categorise on /archive pages --> <!-- Don't categorise on centralised cascade page or its subpages --> | Wikipedia:Cascade-protected items/+ = hide | Main Page = hide <!-- Don't categorise the main page --> categorise should be spelled categorize. centralised should be spelled centralize. /archiv should be spelled /archive Crazymonkey1123 (Jacob) T or M/ Sign mine 20:40, 21 May 2011 (UTC)
/archiv*
to /archive*
would break things. The blacklist uses {{
if pagename}} to do the pattern matching. Here's a quote from its documentation:
I think it would be clearer if this template were called Template:Category handler. Someone reading "cat" might not associate it to categories. Any objections to moving it? — Martin ( MSGJ · talk) 16:35, 22 September 2011 (UTC)
I'd add User:UBX and all subpages thereof. Userboxes should categorize only in userspace, but not the userspace templates themselves. ⇔ ChristTrekker 13:53, 5 October 2011 (UTC)
[[Category:Christian Wikipedians]]
far below the template code. Too far down to be visible on the first page of the edit window. You had to scroll down to see it. And it seems none of the later editors of that template had noticed it.{{category handler | user = [[Category:Somecat1]] | nocat = {{{nocat|}}} }}
I've made a request over at Template talk:Mbox about switching all of the {{ mbox}} family templates, plus the {{ category handler}} template, to use Lua modules. These templates have millions of transclusions, so I would appreciate comments and some more eyes on the code. Please let me know what you think over at the request page. — Mr. Stradivarius ♪ talk ♪ 15:10, 15 October 2013 (UTC)
Moved from Module talk:Category handler. — Mr. Stradivarius ♪ talk ♪ 07:05, 10 April 2014 (UTC)
![]() | This help request has been answered. If you need more help, you can , contact the responding user(s) directly on their user talk page, or consider visiting the Teahouse. |
I copied this module to my local wiki (Tamil). When I use this in {{ mbox}} as {{#invoke:Message box|mbox}} , I get the following error:
Lua error in Module:Category_handler at line 231: attempt to call field '_main' (a nil value). Backtrace: Module:Category_handler:231: ? (tail call): ? Module:Message_box:409: in function "setBoxParameters" Module:Message_box:539: ? (tail call): ? mw.lua:553: ?
I can see that the error is in this module at line number 231: Which is:
local data = nsDetect._main(ndargs)
Can someone please help me? -- Jayarathina ( talk) 15:15, 17 November 2013 (UTC)
There's a discussion at Wikipedia:Village pump (technical)/Archive 125#List of all namespaces on WMF wikis that might interest people here. It concerns possible new default parameter names for Module:Category handler to allow it to be more easily ported to other wikis. — Mr. Stradivarius ♪ talk ♪ 07:08, 10 April 2014 (UTC)
![]() | This
edit request to
Template:Category handler has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
42.104.12.212 ( talk) 10:18, 18 April 2014 (UTC)
I've written a new version of Module:Category handler, located at the following pages:
The new module tries to expand as few parameters as possible to save on performance, in contrast to the current module which automatically expands all of them. This should solve the issue mentioned at Template talk:R from Unicode#Bad code?. It also loads as much data as possible with mw.loadData, to increase performance when it is used many times on a page. The cached data includes the module configuration, the blacklist check results and the list of namespace alias parameters. It is pretty much a complete rewrite; I have reworked it with an object-oriented framework using Module:Middleclass, and I'm getting the arguments with Module:Arguments. Only a small amount of code is reused. Test cases are at Module:Category handler/testcases ( run tests). Please let me know if you have any comments or questions about it; if there are no problems, I plan to update the main module in the next few days. — Mr. Stradivarius ♪ talk ♪ 02:16, 8 July 2014 (UTC)
![]() | This
edit request to
Module:Category handler has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Please make these changes, to remove an unnecessary dependency without affecting any functionality. Jackmcbarn ( talk) 17:35, 13 July 2014 (UTC)
Check Template:Category_handler#Technical_details:
The information seems to be obsolete since the template was ported to Lua in 2011, Module:Category_handler neither uses {{ category handler/blacklist}} or {{ category handler/numbered}}.
-- Escalator~enwikibooks ( talk) 07:57, 22 June 2016 (UTC)
![]() | This
edit request to
Template:Cat handler/blacklist has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Redirect Template:Cat handler/blacklist to Module:Category handler/blacklist instead, to fix a double redirect. SkyGazer 512 Oh no, what did I do this time? 13:15, 27 July 2018 (UTC)
![]() | This is an archive of past discussions. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page. |
Archive 1 |
I am currently designing a template that will make category suppression very simple and mostly automatic. When I have coded, tested and documented the template I will do as I always do: Wait some time before I start to use it, to give others proper time to test it and suggest improvements.
There are probably more usage cases than I know about, so here are some of my thoughts so far, so we can discuss them:
1: I am thinking of calling it {{cat handle}}.
2: The most basic usage will be like this:
{{cat handler| [[Category:Somecat1]][[Category:Somecat2]] }}
3: The default should be to categorise in most namespaces, except those where templates are often just demonstrated or listed and thus should normally not categorise. Thus it will categorise in main, file, help, category and portal space. But it will not categorise in talk, user, wikipedia and template space. So most templates that use {{cat handler}} can probably use the basic syntax above.
4: With some simple parameters one can tell it what namespaces one want it to categorise in. And one will be able to feed different categories for different namespaces, if needed. The parameters will perhaps be similar to how {{ namespace detect showall}} works. See example at point 7 below.
5: It will use a blacklist placed on say "Template:cat handler/blacklist". Pages and page types that should not have categories can be listed there, like for instance the subpages of Wikipedia:Template messages and "/archive" pages. If a template that uses {{cat handler}} is placed on a blacklisted page, then the template will not add any categories. The blacklist will use pattern matching on the pagenames, so the specification will look something like this:
/archive* = hide Wikipedia:Template messages/* = hide
For its pattern matching it will use the meta-template {{ if pagename}} which is very efficient. Category suppression is one of the reasons why I created {{if pagename}}.
6: {{cat handler}} will of course understand the "nocat" parameter. But since it will have the blacklist, in most cases users will not need to use the "nocat" parameter.
7: Here is the full syntax for a really complex usage case:
{{cat handler | 1 = [[Category:Somecat1]][[Category:Somecat2]] | 2 = [[Category:Somecat3]] | 3 = [[Category:Somecat4]] | main = 1 <!--Already default, this line not really necessary--> | help = 2 | user = 2 | talk = <!--No categories on talk pages--> | other = 3 | nocat = {{{nocat|}}} }}
I know how to code the above. But I am not sure if that is the syntax I will use. I am investigating several other ways to specify what namespaces to categorise in. I'm trying to make it more user friendly, but still not causing too nasty code inside {{cat handler}}.
8: I can add the option to feed pagename patterns to {{cat handler}}, so that it can be made to categorise or not categorise on specific groups of pages. Similar to how {{ if pagename}} works. This is for individual templates, while the blacklist sets the default for all usage of {{cat handler}}. Here's an example:
{{cat handler | 1 = [[Category:Somecat1]][[Category:Somecat2]] | /doc = <!--No categories on /doc pages--> | /archive* = 1 <!--Categorise on archives, even if they are blacklisted--> | other = 1 <!--Categorise in all namespaces, but not on blacklisted pages--> | nocat = {{{nocat|}}} }}
But I hope that is not needed, since it would make the documentation of {{cat handler}} scary.
I'd love any feedback about what functionality this template needs.
-- David Göthberg ( talk) 13-14 November 2009 (UTC)
Since
Willscrlt asked me to explain more, below are some examples how templates could be using {{
cat handler}}. The examples show the full code for those templates. Note that these new examples use a slightly improved syntax compared to the explanations in my message above, since I now have figured out how to make {{cat handler}} handle that.
Example 1:
{{ambox | text = This is some message box used on articles. }}{{cat handler | [[Category:Somecat1]] }}<noinclude> {{documentation}} <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude>
Since the category for the above box is fed to {{cat handler}}, that box will only categorise when in main, file, help, category and portal space. It might seem silly that it categorises in all those namespaces, but an article template is hardly ever placed in those namespaces. But it will not categorise in talk, user, wikipedia and template space. And that is good, since in those namespaces most templates are just demonstrated or listed, not used.
The simple syntax shown above can be used for templates meant for any of the namespaces main, file, help, category and portal. Thus covering most of the templates we use. But for templates meant for talk, user, wikipedia or template space, see the examples below.
Example 2:
{{tmbox | text = This is a talkpage message box. }}{{cat handler | talk = [[Category:Somecat2]] <!--Only categorise in talk space--> | nocat = {{{nocat|}}} <!--So "nocat=true" works--> }}<noinclude> {{documentation}} <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude>
The above box will only categorise in talk space. But it will not categorise on /archive pages since they are blacklisted. That is, {{cat handler}} has an "/archive* = hide
" rule in its blacklist. And if you need to demonstrate (discuss) that box on a talkpage, then you can feed "nocat=true" to prevent that template from categorising, like this:
== My new template == Hey guys, have you seen my new talkpage template? {{mytemp|nocat=true}} Nice, isn't it? --~~~~
Example 3:
{{ombox | text = This is a box for the top of WikiProject or Guideline pages or similar. }}{{cat handler | wikipedia = [[Category:Somecat3]] <!--Only categorise in wikipedia space--> | nocat = {{{nocat|}}} <!--So "nocat=true/false" works--> }}<noinclude> {{documentation}} <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude>
The above box will only categorise in wikipedia space. It will not categorise on "Wikipedia talk:" pages. And it will not categorise on for instance
Wikipedia:Template messages/Wikipedia namespace that lists such templates, since that page is blacklisted. That is, {{cat handler}} has a "Wikipedia:Template messages/* = hide
" rule in its blacklist. And if you need to demonstrate that box on another page in wikipedia space, then you can feed "nocat=true" to prevent that template from categorising. But we hardly ever demonstrate such boxes on other wikipedia space pages, so the "nocat = {{{nocat|}}}
" line in that box is not especially needed, so it doesn't matter much if the template programmer forget to add that line.
If you need the box to categorise when on a blacklisted page, then simply feed "nocat=false" to skip the blacklist check. Note that this will not cause the box above to categorise on for instance a talk page, it will just cause categorisation in namespaces for which it has data.
Example 4:
{{mbox | text = This is a box used in several namespaces. }}{{cat handler | main = [[Category:Somecat1]][[Category:Somecat2]] | 1 = [[Category:Somecat3]] <!--For help and user space--> | help = 1 | user = 1 | talk = <!--No categories on talk pages--> | other = [[Category:Somecat4]] <!--For all other namespaces--> | nocat = {{{nocat|}}} <!--So "nocat=true/false" works--> }}<noinclude> {{documentation}} <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude>
In the above example we use a numbered parameter to feed one of the categories, and then we tell {{cat handler}} to use that numbered parameter for both the help and user space.
Example 5:
{{mbox | text = This is a box used in all namespaces. }}{{cat handler | other = [[Category:Somecat1]] <!--Categorise in all namespaces, but not on blacklisted pages--> | nocat = {{{nocat|}}} <!--So "nocat=true/false" works--> }}<noinclude> {{documentation}} <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude>
The above example will categorise in all namespaces, but not on blacklisted pages. If you feed "nocat=true" it will not categorise. And if you feed "nocat=false" it will categorise even on blacklisted pages.
-- David Göthberg ( talk) 17:52, 14 November 2009 (UTC)
Ok. It is making more sense to me now. Thanks! :-)
End, messages moved here from Wikipedia talk:Category suppression. -- David Göthberg ( talk) 04:57, 15 November 2009 (UTC)
{{mytemp | othercat = [[Category:Some other cat]] }}
{{mytemp | nocat = true }} [[Category:Some other cat]]
{{ambox | text = This is the "mytemp" box. }}{{#if:{{{othercat|}}} | {{{othercat|}}} | {{cat handler | [[Category:The mytemp cat]] | nocat = {{{nocat|}}} <!--So "nocat=true/false" works--> }} }}<noinclude> {{documentation}} <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude>
{{ambox | text = This is the "mytemp" box. }}{{cat handler | [[Category:The mytemp cat]] | nocat = {{{nocat|}}} <!--So "nocat=true/false" works--> | othercat = {{{othercat|}}} }} }}<noinclude> {{documentation}} <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude>
{{cat handler | [[Category:Somecat]] }} {{cat handler | 1 = [[Category:Somecat]] }}
{{cat handler | 1 = [[Category:Somecat]] <!--Categorise in the default namespaces--> | wikipedia = 1 <!--And also in wikipedia space--> | nocat = {{{nocat|}}} }}
{{cat handler | 1 = [[Category:Somecat]] | wikipedia = 1 <!--Only categorise in wikipedia space--> | other = <!--Don't categorise in the other namespaces--> | nocat = {{{nocat|}}} }}
{{cat handler | 1 = [[Category:Somecat]] <!--Categorise in the default namespaces--> | main = <!--But not in main space--> | wikipedia = 1 <!--But add wikipedia space--> | nocat = {{{nocat|}}} }}
{{cat handler | user = [[Category:Somecat1]] <!--Categorise in user space--> | talk = {{talkspace detect | user = [[Category:Somecat1]] <!--And in user talk space--> }} | nocat = {{{nocat|}}} }}
{{cat handler | 2 = [[Category:Somecat1]] | user = 2 <!--Categorise in user space--> | talk = {{talkspace detect | user = 2 <!--And in user talk space--> }} | nocat = {{{nocat|}}} }}
2. {{
cat handler}}
works for me. Just as a funny aside (since you mention English is not your native language--though you could have fooled me!), with computers, I often mention a particularly difficult task is like "herding cats" or "wrangling cats". I guess that "cat handler" is somewhat similar to "cat wrangling or herding" ("to herd", "to wrangle", and "to handle" are all similar in meaning in English). That was a long explanation to let you know that the new name makes me smile every time I read it. :-)
1a. At this time, I don't see the need to implement overrides as long as the work-around is documented (so that people like me who try to make things more complicated are shown the easier route to take instead).
1b and 3. Ok. That makes sense. I've just been customizing some templates and ran into issues where the attribute names from one were reused in another using the same names, but for slightly different purposes. It made tracking the logic between different templates a bit tricky. It would have been nice if they had used the same name for the same thing or else distinguished between the different uses somehow. But, since there is already a well-established standard, let's stick with that. At least it sounds like they are all being used for the same thing, and that's good!
4. Ok. Cool.
5. Haha. Nice side effect. That's what most software developers would call a "feature" (a bug that is documented isn't a bug, it's a feature!)
As to "Wikipedia" space vs. "Project" space… sorry. About half of my templating work is cross-wiki template development and conversion. I don't even think of it as the "Wikipedia" space, because on fr.wiki it's "Wikipédia" and on some of the others it is "Vikipedia" or something else. Then you have Commons"("Commons") and Meta ("Project"), and so on. I always refer to it internally (in my brain) as Project space. I know that confuses more en.wiki-centric people, because they think of Projects as WikiProjects. *shrug* I suppose that's how it is with people from the U.S. always thinking that "American" means from the U.S., instead of being from the Americas (Brazilians are Americans, too, of course).
One of the main reasons I use "Project" instead of "Wikipedia" in my template development is that it is one fewer thing that has to be localized (or rather "un-localized" back to the generic) when I move a template to another language or project. I'm hoping that {{
cat handler}}
will port fairly easily. It will be nice to use it on Meta and other projects.
6. Wow! That last example is awesome. You have a really great mind for twisted logic puzzles. No wonder you are interested in cryptography. I'll take your word that distinguishing between talk spaces is not significant. But it's nice to know that there is an example of how to use it.
Perhaps there should be two doc pages. "Basic instructions" and "advanced tips". The basic instructions should be clear and easy for beginners. The Advanced tips could be just a collection of odd/complex examples like you have shown here. Then whenever someone brings up an unusual implementation, it can be added to the tips for future reuse. Better than reinventing the wheel. And, it doesn't overwhelm the average user.
Looks great. It will be a nice feature. And don't worry. I won't touch that template. I'm just working on establishing the related WikiProject for now. — Willscrlt ( “Talk” ) 08:33, 15 November 2009 (UTC)
{{cat handler| project = [[Category:Somecat]] }}
".I think as a general rule, templates should not wind up in the main category name space for categories that they include. I read through this but I don't think I saw any place where this action can be set as the default or can be optionally set other then through the old include only. Vegaswikian ( talk) 06:38, 20 November 2009 (UTC)
{{{1}}}
Are you sure it's a good idea to treat {{{1}}}
as a special case? It seems like it would avoid a lot of complicated explanation in the documentation if you used {{cat handler|default=[[Category:Something]]...}}
instead of {{cat handler|[[Category:Something]]...}}
/{{cat handler|1=[[Category:Something]]...}}
. (Of course, that would mean that you have to explicitly call default=
, instead of using the unnamed first parameter.)
Since {{cat handler}} is only likely to be used when constructing/updating other templates, I don't think there's any harm in removing the special case. Besides, by specifying default=
, you reinforce the idea that this is the default behaviour, and that other options are possible—that will remind editors of exactly what the template is going to do when they transclude it.
TheFeds
02:57, 22 November 2009 (UTC)
usertalk
, projecttalk
, etc.), so that you can prevent (for example) a user talk template from doing anything in file talk space. Also, there should be an explicit option all
for categorizing in all namespaces (for the rare situations where that's desirable).
TheFeds
03:04, 22 November 2009 (UTC){{cat handle|other=[[Category:Somecat]]}}
. When "other=" is used alone it looks a bit odd, but the name makes more sense if you see that it can also be used together with the other parameters, then it means "the other namespaces" as in "the rest of the namespaces". This is established naming for it from the namespace detection templates such as {{
namespace detect}} and {{
main other}}.{{cat handle|[[Category:Somecat]]}}
, and the template takes care of the rest. Forcing people to use a special parameter for the normal case that covers most templates would mean we loose the simplicity.other
, but it's not really the most obvious solution either. (Plus, the documentation wasn't clear whether other
with no additional parameters was intended to be used to mean the same thing as the proposed all
, or if it just conveniently provided that function.){{cat handler|default=[[Category:Something]]...}}
. They'll all have to consult the docs page at this point, so I don't think there's a major possibility for confusion. And this template will only be used occasionally in specialized contexts—because it's you only transclude it when you're editing another template—so there's not a huge advantage to providing the simplified syntax for the default case. In my view, the advantage of not having to deal with a special case when learning the template outweighs the small benefit of a short form for {{{1}}}
only.
TheFeds
16:27, 22 November 2009 (UTC){{cat handler | all = [[Category:Somecat]] <!--Categorize in all namespaces--> }} {{cat handler | main = [[Category:Somecat1]] <!--Categorize in main (article) space--> | talk = [[Category:Somecat2]] <!--Categorize in talk space--> }} {{cat handler | all = [[Category:Somecat1]] <!--Category for all namespaces--> | main = [[Category:Somecat2]] <!--But use this in main space--> | talk = <!--But no categories on talk pages--> }} {{cat handler | all = [[Category:Somecat1]] | main = [[Category:Somecat2]] | talk = }}
[[Category:Somecat1]] [[Category:Somecat2]]
". And it looks like for talk space the user simply didn't bother to feed any category, thus one would expect to get "[[Category:Somecat1]]
".I am planning to add one or two new parameters, and I would like some feedback on their naming and values. Here's a first example:
{{cat handler | [[Category:Somecat]] | subpage = no <!--Don't categorize on subpages--> }} {{cat handler | [[Category:Somecat]] | basepage = no <!--Don't categorize on basepages--> }}
I have just been testing to add {{ cat handler}} to some templates. (I just edited their /sandbox pages to use {{cat handler}} instead of their old categorization code.) I discovered that some templates don't want to categorize on subpages, for instance to avoid categorizing on /doc and /sandbox pages. And I know many of the Wikipedia space pages have subpages with the page header, and then we don't want templates to categorize on those header subpages. So I am thinking of adding a parameter (or two) so one can choose if this template will categorize on subpages or not. I don't know if there is any cases with the opposite, where one would only want to categorize on subpages, but we should probably support that case too when we are at it.
We could also use a single parameter to handle both cases. That would be convenient if a template wants to forward the parameter, since then only one parameter needs forwarding to do both things. But it causes slightly more complex values. Like this:
{{cat handler | [[Category:Somecat]] | subpage = no <!--Don't categorize on subpages--> }} {{cat handler | [[Category:Somecat]] | subpage = only <!--Don't categorize on basepages--> }} {{cat handler | [[Category:Somecat]] | subpage = {{{subpage|}}} <!--So "subpage=no/only" works--> }}
Adding this function to {{ cat handler}} is easy and fairly efficient. And if I do it right then it has additional benefits such as that the "page" parameter can be used to test also the basepage/subpage categorization of a template.
-- David Göthberg ( talk) 08:46, 24 November 2009 (UTC)
subpage=yes
, do the subpages too. Almost every template can be expected to have a /doc page, and many have /code and other subpages that aren't meant to be directly used. And usually, the category specifically refers to what the main template does, not to the function of the subpages.subpage=only
is a good feature.
TheFeds
17:07, 24 November 2009 (UTC)subpage=only
" and "subpage=no (or yes)
".subpage=yes
" option. (Note mostly to myself: Stopping all subpages should not be done from the blacklist, since then one would have to use "nocat=false
" which would cause categorizing on other unwanted pages too.)subpage=no/only
" option and documented it. For the reasons described above I choose the default to categorize in subpages. This is of course not set in stone. I still would like to hear what people think about the parameter and its naming etc.subpage=no/only
" check, then yes we get fewer code lines. But then {{basepage subpage}} would be called on every usage of this template, which costs database lookups and would cause more damage if someone does a bad edit to {{basepage subpage}}. So putting the call inside the "subpage=no/only
" check uses less resources and is more robust.This template is way too heavy. The ability to tell a template not to categorise is trivially implemented; all it requires is to wrap your categories in a single #if statement. But this template binds it up with all manner of rarely-needed functionality, making a great many pages unnecessarily heavy on the processor. It think it is a solution looking for a problem, and should be dumped. Hesperian 23:48, 29 November 2009 (UTC)
{{cat handler | main = [[Category:Somecat1]] <!--Categorize in main (article) space--> | talk = [[Category:Somecat2]] <!--Categorize in talk space--> | nocat = {{{nocat|}}} <!--So "nocat=true" works--> }}
Preprocessor node count: 165/1000000 Post-expand include size: 496/2048000 bytes Template argument size: 105/2048000 bytes Expensive parser function count: 0/500
Preprocessor node count: 237/1000000 Post-expand include size: 955/2048000 bytes Template argument size: 167/2048000 bytes Expensive parser function count: 0/500
nocat={{{nocat|}}}
" option and so on.Regarding the value 'h0#384!5nea+w9', I assume this is just a non-empty, never-be-used-as-a-parameter value. Can we use something better? I have a bot that really gets confused and many templates use the value '¬' in this case. Actually this template does too some lines above. Or is this some magic code that I'm missing? Hopperpl ( talk) 19:53, 29 November 2009 (UTC)
h0#384!5nea+w9
" is fed to one of the parameters. But that anyone would ever feed "h0#384!5nea+w9
" is exceedingly unlikely. (And it can never even be a category name since it lacks "[[Category:]]
" and it contains "#
" which can't be used in page names in MediaWiki.) There is no reason it should confuse your bot, since that value should never be fed to the template, it is only used internally. So your bot should never see that value.{{#ifeq: h0#384!5nea+w9 | {{{talk| {{{user| h0#384!5nea+w9 }}} }}} | <!--Both "talk" and "user" are undefined--> | <!--"talk" and/or "user" has data or is empty but defined--> }}
cagegory =
" parameter we have the option to feed "category = {{{category|¬}}}
". But ouch! You made me reread the code and study the category parameter. The backwards compatibility with "category =
" was added afterwards, since some users asked for it. But I see now that we have a parameter name collision. This template already used "category =
" to mean "don't categorize in category space". I have disliked that ugly "category = {{{category|¬}}}
" hack from starters, and now I see it collides with the name of the namespace, it is evil! Hopperpl: Thanks for making me find this bug. I have to ponder what to do with that.Thoughts on this? For example, ifexist "BASEPAGENAME/catno" it would not categorize, and ifexist "BASEPAGENAME/catyes" it would categorize. – xeno talk 16:21, 16 December 2009 (UTC)
yes
" or "no
" in it. Then the user himself can modify the value when needed, without having to ask an admin. (We can easily check the content of a subpage like that by using template code, we have already tested this for another template.)no
" in it.all no
" to prevent categorization on the page and all its subpages, or the value "subpages no
" to only prevent the subpages to categorize but not the page itself. (Or perhaps the shorter values "no+
" and "no*
", but that is perhaps to cryptic.) This could also be useful in other spaces than user space, although for the other spaces the blacklist already works well. And of course if we feed "nocat=false
" to a template it should not check the "/categorize" subpage just as "nocat=false
" overrides the blacklist.no
" is preventing categorization. ( {{Cat handler}} should not add that category when it suppresses categorization based only on namespace, since that is normal usage.) And on that category page I will put an explanation about why some pages don't show categories. That would give users a chance to figure out what is going on.Would it be possible to allow |nocat=yes
to work as well as |nocat=true
? Thanks. --
WOSlinker (
talk)
23:35, 6 January 2010 (UTC)
categorize=no
" since I find that clearer. But adding a new method probably is bad, so for now I prefer the old method "categories=no
" which {{cat handler}} already understands.{{
editprotected}}
Since there has been no opposition on
the technical village pump and the main page shouldn't be categorized by templates, could you add |Main Page=hide <!-- don't categorize the main page -->
to {{
Cat handler/blacklist}}? This edit would also reduce the harm of possible mistakes when someone mistakenly adds a template to the main page. --
The Evil IP address (
talk)
21:52, 2 June 2010 (UTC)
I think that the black list should also excempt the sandbox and related pages, e.g. {{ X1}} or {{ X2}}. Categorization there is often pointless. -- The Evil IP address ( talk) 19:13, 25 May 2010 (UTC)
![]() | This
edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Where it shows: | Wikipedia:Template messages/* = hide <!-- Don't categorise on its subpages --> | /archiv* = hide <!-- Don't categorise on /archive pages --> <!-- Don't categorise on centralised cascade page or its subpages --> | Wikipedia:Cascade-protected items/+ = hide | Main Page = hide <!-- Don't categorise the main page --> categorise should be spelled categorize. centralised should be spelled centralize. /archiv should be spelled /archive Crazymonkey1123 (Jacob) T or M/ Sign mine 20:40, 21 May 2011 (UTC)
/archiv*
to /archive*
would break things. The blacklist uses {{
if pagename}} to do the pattern matching. Here's a quote from its documentation:
I think it would be clearer if this template were called Template:Category handler. Someone reading "cat" might not associate it to categories. Any objections to moving it? — Martin ( MSGJ · talk) 16:35, 22 September 2011 (UTC)
I'd add User:UBX and all subpages thereof. Userboxes should categorize only in userspace, but not the userspace templates themselves. ⇔ ChristTrekker 13:53, 5 October 2011 (UTC)
[[Category:Christian Wikipedians]]
far below the template code. Too far down to be visible on the first page of the edit window. You had to scroll down to see it. And it seems none of the later editors of that template had noticed it.{{category handler | user = [[Category:Somecat1]] | nocat = {{{nocat|}}} }}
I've made a request over at Template talk:Mbox about switching all of the {{ mbox}} family templates, plus the {{ category handler}} template, to use Lua modules. These templates have millions of transclusions, so I would appreciate comments and some more eyes on the code. Please let me know what you think over at the request page. — Mr. Stradivarius ♪ talk ♪ 15:10, 15 October 2013 (UTC)
Moved from Module talk:Category handler. — Mr. Stradivarius ♪ talk ♪ 07:05, 10 April 2014 (UTC)
![]() | This help request has been answered. If you need more help, you can , contact the responding user(s) directly on their user talk page, or consider visiting the Teahouse. |
I copied this module to my local wiki (Tamil). When I use this in {{ mbox}} as {{#invoke:Message box|mbox}} , I get the following error:
Lua error in Module:Category_handler at line 231: attempt to call field '_main' (a nil value). Backtrace: Module:Category_handler:231: ? (tail call): ? Module:Message_box:409: in function "setBoxParameters" Module:Message_box:539: ? (tail call): ? mw.lua:553: ?
I can see that the error is in this module at line number 231: Which is:
local data = nsDetect._main(ndargs)
Can someone please help me? -- Jayarathina ( talk) 15:15, 17 November 2013 (UTC)
There's a discussion at Wikipedia:Village pump (technical)/Archive 125#List of all namespaces on WMF wikis that might interest people here. It concerns possible new default parameter names for Module:Category handler to allow it to be more easily ported to other wikis. — Mr. Stradivarius ♪ talk ♪ 07:08, 10 April 2014 (UTC)
![]() | This
edit request to
Template:Category handler has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
42.104.12.212 ( talk) 10:18, 18 April 2014 (UTC)
I've written a new version of Module:Category handler, located at the following pages:
The new module tries to expand as few parameters as possible to save on performance, in contrast to the current module which automatically expands all of them. This should solve the issue mentioned at Template talk:R from Unicode#Bad code?. It also loads as much data as possible with mw.loadData, to increase performance when it is used many times on a page. The cached data includes the module configuration, the blacklist check results and the list of namespace alias parameters. It is pretty much a complete rewrite; I have reworked it with an object-oriented framework using Module:Middleclass, and I'm getting the arguments with Module:Arguments. Only a small amount of code is reused. Test cases are at Module:Category handler/testcases ( run tests). Please let me know if you have any comments or questions about it; if there are no problems, I plan to update the main module in the next few days. — Mr. Stradivarius ♪ talk ♪ 02:16, 8 July 2014 (UTC)
![]() | This
edit request to
Module:Category handler has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Please make these changes, to remove an unnecessary dependency without affecting any functionality. Jackmcbarn ( talk) 17:35, 13 July 2014 (UTC)
Check Template:Category_handler#Technical_details:
The information seems to be obsolete since the template was ported to Lua in 2011, Module:Category_handler neither uses {{ category handler/blacklist}} or {{ category handler/numbered}}.
-- Escalator~enwikibooks ( talk) 07:57, 22 June 2016 (UTC)
![]() | This
edit request to
Template:Cat handler/blacklist has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Redirect Template:Cat handler/blacklist to Module:Category handler/blacklist instead, to fix a double redirect. SkyGazer 512 Oh no, what did I do this time? 13:15, 27 July 2018 (UTC)