Help talk:Template
It is requested that a video clip or video clips of video-tutorial (with captions/subtitles for the deaf or hard of hearing) be included in this article to improve its quality. |
This help page does not require a rating on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||||||
|
Help:Template has an associated feedback page, Help:Template/feedback. It should be checked regularly, and posts responded to or deleted as appropriate. |
|
|||||
This page has archives. Sections older than 90 days may be automatically archived by Lowercase sigmabot III when more than 4 sections are present. |
Template recursion limits
editI attempted to clarify the recent change to the page's description of the restriction on a template calling itself. My change was reverted in its entirety by User:Mathglot, and I looked at the discussion at Wikipedia:VPT#Invalid detection of infinite template loop with only one level of nest and discovered that I had misunderstood the rule.
The fact that I didn't understand the restriction when I read it on this help page proves it isn't clear, and I'd like to fix it.
It appears to me that User:PrimeHunter is saying that any attempt by a template to call itself during expansion fails, but that there's no restriction on a template calling itself when the template page is being displayed itself. The ability for a template to call itself when displayed is widely used for documentation, because it means when you display a template, you can see an example of the template result.
The text as it stands is
Generally, template recursion is forbidden; that is, a template may not call itself. Attempting to do so produces an error message and causes the page to be marked by MediaWiki as having a template loop. The one exception is that a template may call itself on its own template page for the purpose of documentation.
I find this confusing because a) it's not clear whether "forbidden" is just a policy or MediaWiki implementation. This appears to say you don't get the error message if the template calls itself for documentation, as if there's some way MediaWiki can distinguish a documentation call. "Call itself on its own template page" is really confusing, because "template page" just means "template", with emphasis on the fact that a template is a page, and how would a template call itself on any other page? A call to a template on the template's own page is in fact rejected when you try to expand that template (page).
Also, I don't understand what "marked as having a template loop" means. Where is this marking?
How about this:
Template recursion does not work. Expansion of a template that calls itself fails with an error message. However, you can display a template page directly that contains a call to itself, and this is widely done for documentation, so the reader of the page can see an example of the template result.
Bryan Henderson (giraffedata) (talk) 04:21, 25 February 2024 (UTC)
- @Giraffedata: See this instance of Template:X14. It displays a message similar to: Template loop detected: Template:X14. It's also in Category:Pages with template loops. --Redrose64 🌹 (talk) 20:25, 24 February 2024 (UTC)
- Giraffedata, Thank you for bringing this here. I agree that "forbidden" is ambiguous, and perhaps "not supported by mediawiki software and returns an error" is better. {{X14}} is an obvious case because it calls itself directly, but earlier, I had created templates Draft:Recur-A and Draft:Recur-B to clear up any misunderstanding about whether the issue is merely direct vs. indirect calls, to show that neither is permitted. You can't determine that from X14 alone, but you can see that indirect loops also throw errors here:
{{Draft:Recur-A|oops}}
⟶ Draft:Recur-A
- But at this point, it sounds like we are just trying to find the right wording, is that your view as well? If so, then I believe briefer is better, and the fewer words we can use to say that except for Template doc it won't work so don't even try, the better. Mathglot (talk) 22:18, 24 February 2024 (UTC)
- Made an attempt to tighten up the wording and respond to your issues. See what you think. Mathglot (talk) 01:23, 25 February 2024 (UTC)
- The basic problems are still there. "Unsupported" is as ambiguous as "forbidden". Unsupported typically means someone won't help you do it -- it might work, but you're on your own. You get no support. Recursion just plain doesn't work -- you can't do it, so why don't we just say that? And it isn't true that whether a template call works or not depends on whether it is called for the purpose of documentation. The distinction is that it works when the template is displayed, but not when the template is expanded.
- If you want to keep it brief, then just don't mention documentation as an application of a template calling itself at all. The page explains elsewhere the difference between expanding and displaying a template and the concept of displaying a template to see documentation. Bryan Henderson (giraffedata) (talk) 04:21, 25 February 2024 (UTC)
- I see what the problem is now. The term unsupported in the world of a software feature is an ambiguous term, and can either mean what you inferred regarding no customer service, but just as often means the software is not capable of it:
- Currently, MyEclipse Blue Edition is available for Windows and Linux, though Mac is unsupported.[1]
- applications are single-threaded; multithreading in Trusty userspace currently is unsupported[2]
- Development using either HTML5 or WinJS is unsupported on Windows Phone 8.[3]
- As the symbol is unsupported by Ceefax/Teletext, a number sign - which resembles a musical sharp - is substituted.[4]
- This setting is not used by all platforms; changing its value is unsupported.[5]
- I used unsupported in that sense, but I'll try to find different wording. The phrase does not work is out, because like a car that does not work, it implies that something is wrong with it that need repair—that is not the case here, as it is working as designed. Mathglot (talk) 23:25, 25 February 2024 (UTC)
- Changed it to:
- Template recursion is not available; that is, a template may not call itself directly, or indirectly by calling other templates which call it. Attempts to do so will result in an error message describing a "template loop".
- Mathglot (talk) 23:30, 25 February 2024 (UTC)
- Thank you. And I agree about the problem with "does not work".
- On the matter of "support", you're absolutely right that it is often used exactly the way you used it, in addition to many other ways. I change "support" almost everywhere I see it in a technical context in Wikipedia both because of its ambiguity and the fact that there is always a plainer way to say whatever it's supposed to say. I think "support" is one of those things people say because it sounds smarter. Fundamentally, support means to hold up; metaphorically, it means to assist. When I read "the website supports JPEG", I wonder, "Does JPEG need this website's support?". Bryan Henderson (giraffedata) (talk) 20:01, 26 February 2024 (UTC)
- I see what the problem is now. The term unsupported in the world of a software feature is an ambiguous term, and can either mean what you inferred regarding no customer service, but just as often means the software is not capable of it:
- Made an attempt to tighten up the wording and respond to your issues. See what you think. Mathglot (talk) 01:23, 25 February 2024 (UTC)
Nesting template
editin the nesting templates section under creating templates, in the second example, shouldn't it have a '3' in the line of code for template A, instead of a '1'? Or am I missing something? JoeJShmo💌 08:00, 19 July 2024 (UTC)
- Yes, it should by 3. I've fixed it. Bryan Henderson (giraffedata) (talk) 17:00, 19 July 2024 (UTC)
Inappropriate use of templates?
editIs there anywhere on Wikipedia that details inappropriate use of templates? I have the feeling that {{rut}} and {{rus}} only exist to replace simple links, but I can't find a policy that outright forbids this. If I were to send those templates to WP:TfD, would they likely survive deletion? – PeeJay 13:14, 22 July 2024 (UTC)
- Yes, they will absolutely survive deletion. There is no policy which forbids templates which create links, let alone one that also finds flags and team icons. Did you even check the transclusion count? Because these are both heavily used, with one of them protected because it is used thousands of times. Of course, the talk page history shows that
{{rut}}
is actually merged from several "rut" templates for individual teams. I would highly advise leaving it alone unless you really, absolutely need one of the template shortcuts, in which case you might be able to get a bot to expand all the calls before getting the redirect removed. But you'd have to make a pretty significant argument why you can't use anything else. VanIsaac, GHTV contWpWS 04:40, 23 July 2024 (UTC)