Wikipedia talk:Template documentation/Archive 1

Latest comment: 16 years ago by Davidgothberg in topic Template doc
Archive 1 Archive 2

"/doc" or "X/doc"?

Using {{/doc}} instead of {{X/doc}} does have the benefit, that it transcludes the doc page which is relative to the name of the template. So moving the template to another name, say "Y", does still expect that the doc page of Y is at Y/doc and not shared with the doc page of X. So, for now I'm going to change this back at the project page, until there are other arguments. --Ligulem 07:46, 31 August 2006 (UTC)

The '/doc' format can be used as a 'cut and paste' standard on any template page (allowing its use even by people who don't understand it) and is shorter and thus better for staying under the transclusion limit. Sub-pages apparently do not get moved when the primary page is move... so using 'X/doc' would allow the old sub-page to still be displayed if the template itself were moved to 'Y'. However, I don't think we would want template and documentation to reside in different locations and thus presumably we would move the '/doc' page separately. At which point '/doc' works just as well and doesn't require an 'X' to 'Y' update of the link on the template page itself. --CBD 11:12, 3 September 2006 (UTC)

Good idea

I have a slight concern over it. I have been playing (for legitimate reasons!) with noincludes etc. and it seems to me that something like:

</noin<noinclude> evil grin </noinclude>clude> rude message here

in the /doc would break this model.

Rich Farmbrough 09:32 1 September 2006 (GMT).

I discussed this with CBD and he convinced me that it isn't possible to foul this pattern. You can do whatever you want on the doc page, everything that is transcluded into the main template page is still inside noincludes, because the main template page has it so. If the main template is protected, then it is impossible to inject anything via doc into the template. Ok, you can vandalise the documentation display of the template, but that's all. Transclusions of the main template are not affected. So I say no. Do you have an actual example (in a sandbox or somewhere) that would prove me wrong? (not that I would think so, but I could be wrong, who knows ;-). --Ligulem 09:55, 1 September 2006 (UTC)
The evaluation of any given page processes 'noinclude' style tags before it brings in the contents of any transcluded templates... thus there is no further evaluation of any 'noinclude' style tags those templates may contain. So, the above would evaluate as '</noinclude> rude message here' on the template page (actually displaying the 'noinclude' tag there), but then as nothing on pages to which that template were transcluded because it is inside 'noinclude' tags on the template page. Another way of looking at it is that transcluded 'noinclude' tags are treated strictly as text. --CBD 11:25, 3 September 2006 (UTC)

Loved the idea ...

How do i replicate this effect at pt.wikipedia??? thanxs a bunch .. Biasuz 16:33, 3 September 2006 (UTC)

Hmm, I fear I don't know what your problem is. Why not just use it on pt on a template? Good candidates are templates that are used often or templates with a long documentation. However, if you are not sure how it works, it might be good to start up slowly and do it on a non-critical template first as a trial. Just some thoughts ;-). --Ligulem 16:44, 3 September 2006 (UTC)
This effects seems to be impossible to replicate in Slovenian WP as well. I added <noinclude>{{/doc}}</noinclude> to a template and got link to the template:/doc page instead of the template:templatename/doc page. --Eleassar my talk 08:55, 18 September 2006 (UTC)
I've fixed that in the description. Try <noinclude>{{{{FULLPAGENAME}}/doc}}</noinclude> instead. --Ligulem 09:12, 18 September 2006 (UTC)

Wrong additions of interwikis

Wikipedians do have problems understanding that interwikis (and categories) should go to the doc subpage. They often add interwikis on the main template page instead of on the doc page. I've thus added a comment into the copy/paste reciepe.

However, I'm not happy with that, because it eats up from precious pre-expand include size. If anybody has a better idea to make this pattern less error prone for interwiki adding Wikipedians, please let me know by posting here. --Ligulem 11:41, 23 September 2006 (UTC)

Including categories with fields

Having a problem with categories in the /doc file (on another site, private sorry I can't provide example). It just doesn't seem to work. I inserted the category command, e.g. [[Category:foo]], but it does not show up as a category on pages where the template is used. All the other documentation appears correctly on the template page itself when it's viewed. Should this always work or does it require a certain version of wikimedia to function correctly?Elf | Talk 22:47, 26 September 2006 (UTC)

If you add categories to the doc page per this pattern, then these categories end inside <noinclude>...</noinclude> in the template, which means the template itself is added to the category. If you want to add pages to a category where the template is transcluded, then those categories must be added to the template outside <noinclude>...</noinclude>. The pattern as described here is only for documentation of the template and adding the template itself to categories. Everything else must stay outside of the doc page and outside <noinclude>...</noinclude>. Also, I don't know of any software version dependency. In other words, if you do write [[Category:foo]] into a template and transclude that template into a page P, then P is added to foo, provided that [[Category:foo]] was put outside <noinclude>...</noinclude> clauses, which isn't the case if you add a category to the doc page as described here. See also m:Help:Template. --Ligulem 23:04, 26 September 2006 (UTC)

Thanks. The comments are so emphatic about catg's not being in the template that I was convinced. (Of course, by having an example of the template's output in the template's documentation, this then puts both the /doc and the template into the category... oh, well...) Elf | Talk 17:32, 27 September 2006 (UTC)

Well, people should still know whether they want their cat in noinclude-land or not. If they don't know, they'd better first ask ;). But I admit the comment is really emphatic. I just didn't know what else to do to detain people from adding the noinclude-land cats and interwikis to the template page instead of to the doc page. This was also one of the reasons why I was first a bit reluctant to do the cats and interwikis on the doc page. But going through a cache invalidation of all transculding pages only because yet another interwiki wants to join they party is - erm - rather suboptimal. People do have problems to understand that. But maybe I should simply refrain from applying the doc page pattern to non-protected templates. Anyway, to my defense, I can say: the comment says "not here!" and that comment line is inside noinclude-land ....:] --Ligulem 18:08, 27 September 2006 (UTC)

This page is too wide so I'll fix it.

This page is too wide so I'll fix it. -- Chuck Marean 09:31, 14 October 2006 (UTC)

Done. -- Chuck Marean 09:35, 14 October 2006 (UTC)

Better header

This header places a different notice at the top of the /doc page when viewed directly informing the viewer that there may be broken links because of variables. Any objections to making this the standard header text? It's in action at {{Lorem ipsum}} (/doc), and I've created a template that can be subst'd to include this text at User:Flamurai/Template doc page header.

<noinclude>:''This is the [[Wikipedia:Template doc page pattern|doc page]] 
for {{tl|{{BASEPAGENAME}}}}. It is not intended to be viewed directly. 
Therefore, if it uses [[Help:Variable|variable]]s, some links may appear 
broken. Do not replace these variables with [[hardcoded]] page names or URLs.
</noinclude><includeonly>:''This template documentation is 
[[Wikipedia:Template doc page pattern|transcluded]] from [[{{FULLPAGENAME}}/doc]]'' 
[<span class="plainlinks">[{{fullurl:{{FULLPAGENAMEE}}/doc|action=edit}} edit]</span>]
</includeonly>

(This could be an alternative when relative variables are used on the page.)

– flamurai (t) 03:12, 11 November 2006 (UTC)

No objections from me. --Ligulem 09:52, 11 November 2006 (UTC)

New idea: Create two templates, then change the template on this page to be something like:

<includeonly>{{Template doc page included}}</includeonly><noinclude>{{Template doc page viewed directly}}</noinclude>

Where the first template is the current "This template documentation..." and the second would be the new header. I created a new version in a box: User:Flamurai/Template doc page viewed directly This hides the variables and cleans up the top of the page. – flamurai (t) 20:17, 11 November 2006 (UTC)

Could you give a full working example? For example on {{Lorem ipsum}}? --Ligulem 17:37, 12 November 2006 (UTC)
Done. – flamurai (t) 00:51, 15 November 2006 (UTC)
Looks good. Merged into recipe. --Ligulem 16:06, 15 November 2006 (UTC)

unmatched includeonly tags?

The first example in the How to do it section seems to have an unmatched number of includeonlys. I thought these needed to be matched? Or can you start includeonly's multiple times? I would have changed it but I am not sure it's an error... Thanks! (this is an interesting technique! I know a template that should use it already.) ++Lar: t/c 11:48, 15 November 2006 (UTC)

Nope. Everything fine. Just scroll to the right. --Ligulem 15:23, 15 November 2006 (UTC)

Putting {{fact}} on it

Freak seems not to believe in the original research presented here. Since this page here is close to "primary source" material, I suggest you post your concerns here instead of re-inserting {{fact}}. Thank you. --Ligulem 23:52, 16 November 2006 (UTC)

noinclude vs. includeonly

Okay... I'm feeling dense, but I'm trying to get my head around this. What do the <noinclude> and <includeonly> tags acutally do? (ex: such as using them in a userbox template). In laymen terms please. Drcwright 08:11, 16 December 2006 (UTC)


In short (hopefully not too short!):
Anything between <noinclude> .... </noinclude> on a page is not included when that page is transcluded on (roughly, "used on" – visit the link for more info) another page. Example:

Template "Blah1"'s code:

This is the code for
a template named "Blah1" 
<noinclude>– but this
bit of code won't be
used! –</noinclude> and
this is the end of the
code.

In the code for another page, say an
article, the template "Blah1" is called:

This is an article about
blah blah blah, bla-blah
blah blah blah...
{{Blah1}}
Blah bl-blah blah, blah
blah blah bla-blah blah...

–result→

This is an article about
blah blah blah, bla-blah
blah blah blah...
This is the code for a
template named "Blah1" and
this is the end of the code.
Blah bl-blah blah, blah
blah blah bla-blah blah...

Meanwhile, anything between <includeonly> .... </includeonly> on a page is only included when that page is transcluded ("used on") another page. Example:

Template "Blah2"'s code:

This is the code for
a template named "Blah2"
<includeonly>– and this
is the code that's only
used when the template
is transcluded! –
</includeonly> and
this is the end of the
code.

   result when
–template page→
   is viewed

This is the code for a
template named "Blah2"
and this is the end of
the code.

---------------THEN:--------------

In the code for another page, say an
article, the template "Blah2" is called:

This is an article about
blah blah blah, bla-blah
blah blah blah...
{{Blah2}}
Blah bl-blah blah, blah
blah blah bla-blah blah...

—————result→

This is an article about
blah blah blah, bla-blah
blah blah blah...
This is the code for a
template named "Blah2" –
and this is the code that's
only used when the template
is transcluded! – and this
is the end of the code.
Blah bl-blah blah, blah
blah blah bla-blah blah...

Hope enough of the above makes sense!  Best wishes, David Kernow (talk) 10:02, 16 February 2007 (UTC)


Possible small amendments to the paragraphs about how to create a subpage

While copying the "Template doc page pattern" page (on 24 April, before it was moved!) and (weeks later, without knowing of the move) the "Template documentation" page to the Genealogy Wikia (with proper acknowledgment, I hope), I noticed that both had similar-looking instructions. (Having only just revisited the one with the long name and seen that it was moved, I can understand why there is some commonality. But I digress.) Each had a few sentences that the other didn't have. And it all looked good, although maybe the material that was unique to the older page has been deliberately removed since. After detailed comparison I merged the two (adding headings and rearranging paragraphs a little) at http://genealogy.wikia.com/wiki/Genealogy:Template_doc_page_pattern and reduced the instructions on "Template documentation" to a mere link to the new merged instructions.

I'd like one of you experts to check that I got everything right. Then I can copy it to here for a wider audience. (Then, of course, one day, I can merge the Genealogy pages to match the new WP page and make the old one a redirect until the seven pages that link to it are changed.)

Thanks to all you marvellous template programmers. I sing your praises here and there!

Robin Patterson 13:43, 29 May 2007 (UTC)

Template doc

I think that {{template doc}} is a bit to "in your face". It makes the documentation hard to read. It is too colourful and doesn't match the Wikipedia colour scheme. The image   is cute but adds to the overall "information stress" of the design. And the horizontal line immediately under the title also is unnecessary. Especially since below that normally is transcluded in the sentence "This documentation is transcluded from Template:X/doc. (edit | history)" surrounded by two horizontal lines. Sure, without all that decoration it looks more boring, but the point is to make the documentation readable, not to pimp or template pages as much as possible. --David Göthberg 10:49, 10 August 2007 (UTC)

I somewhat concur with your opinions regarding the background colours, and I'd prefer a less invasive design. One suggestions is to not include {{template doc}}, since it isn't required and was added to this template page recently, in the 2007-06-04T07:33:23 revision by User:Chochopk. Here is an example of a template that doesn't use it. You may also suggest to redesign {{Template doc inline}} to remove boarders and change colors (i.e., replace style="background-color:#ecfcf4; border:1px solid #aaa; with style="background-color:transparent; border:none;, or something like that.) +mt 15:18, 10 August 2007 (UTC)
Thanks for the complete answer! Yes, when I first encountered this kind of subpage docs they were without boxes and just had the thin {{template doc page transcluded}} header. And the first time I used this kind of subpage docs myself that was what I used. But I like having the transcluded documentation surrounded by some kind of box so it is clear what is the transcluded part. And yes, I am aware that the colours etc in this case are coded in {{Template doc inline}}. I just wanted to say my "complaints" in an as easy to understand way as possible for everyone. I thought it was better to bring that discussion up here since this is kind of the "project page" for those templates, right? And sure, I can design my own boxes. But I thought I didn't want to add more box templates and instead first discuss it here. Oh, I seem to remember there are some ready made simple grey/blue generic box templates. They could be used for this. But they of course lacks the view and edit buttons. --David Göthberg 16:11, 10 August 2007 (UTC)
As far as the background colour is concerned, here are a few suggestions (which I can barley see differences on my laptop screen):
Original: #ecfcf4; Lighter: #f2fcf7; (½ saturation) Lighter: #f2f9f4; (more grey) Blue-er: #ecf8fc;
I'm not sure how to deal with the horizontal lines in {{template doc page transcluded}} ("transcluded") right now, since it is used with/without {{template doc}} ("tdoc"). It would be nice to have the "tdoc" functionality included in the "transcluded" template, however then all template instances of "tdoc" would have to be edited manually or by a bot to remove the "transcluded" instance. The "transcluded" template would then be used for older template documents. Could this work? It would mean a bit of work, of course. +mt 17:24, 10 August 2007 (UTC)

Oh, I forgot that most people use LCD screens nowadays. Then more colours are needed. (I use CRT screens.) So don't bother about the colour. The only changes I would like then is that we remove the image and the horizontal border under the {{template doc inline}} header. No other changes needed to make the template much less "invasive". And that should not "break" any of the old pages that only use one of the two templates.

Then it looks like this:

[view] [edit]Template documentation


This template bla bla bla...

What do you think? --David Göthberg 18:23, 10 August 2007 (UTC)

This will work well, as it does not have   and is not a level two header, some editors have utilized level three headers for the sections because the title for the documentation was a level two header. I suggest removing "Template", readding a divider.and implementing. --209.244.43.122 (talk) 19:52, 17 February 2008 (UTC)
Consider using a larger font size without a divider. --209.244.43.122 (talk) 18:44, 14 March 2008 (UTC)


So lets try with a bigger font size and a divider:

[edit]Documentation


This template bla bla bla...

Nah, I don't think it looks nice with the bigger font size. But I like the divider since the   was removed. But 209.244.43.122, you should really consider getting an account and logging in, even though you seem to have a fixed IP. I nearly did not respond to you since you were "merely" an IP user. Most of us have very bad experiences with them and have problems keeping them apart (all IPs look the same to most of us). And only signing with a number instead of a name or nick is very impersonal.

--David Göthberg (talk) 20:00, 14 March 2008 (UTC)

Redirect of /doc talkpage

I saw somewhere that someone had redirected the talkpage of a /doc subpage to the talkpage of the template itself. Thus making it so that all talk relating to the template and its documentation ends up on the same talkpage. I liked it so I have started using it myself. For instance, try to click on the "discussion" tab on this page: Template:·/doc.

I suggest that we add that as a recommendation to this guideline.

--David Göthberg 14:27, 21 August 2007 (UTC)

Since no one has said anything yet I boldly went ahead and added the recommendation.
--David Göthberg 10:30, 11 September 2007 (UTC)

{{template doc page transcluded}}

Remember the dot: You removed the {{template doc page transcluded}} twice and I reverted you twice. So time for me to explain why we still need it.

{{template doc page transcluded}} adds several things that the {{template doc}} does not add and in the third case below never can add.

  • It adds an explanation that the documentation is transcluded from somewhere else, and that the somewhere else is /doc.
  • It adds a link to here Wikipedia:Template documentation. By clicking that link in a template documentation was how I found this how-to guide. I think that link is the primary marketing tool for this how-to guide. Remove that link and no more editors will learn about this guide.
  • It gives the basic links to reach the documentation even in the cases when there is no {{template doc}} on the template page. That is, when only a {{/doc}} has been used. You wrote in one of your edit comments "This change will go into effect only for new documentation pages which will, per the instructions of this page, use {{template doc}}". Unfortunately Wikipedia is not that perfect. See, many template pages are locked. And many of us non-admins upgrade old /doc pages according to this how-to guide. But we don't bother about the hassle to write up a {{editprotected}} explanation to get the template page itself updated. You know, many editors don't even know about {{editprotected}} or how to use it. (And the explanations in the editprotected documentation at least did scare me off from using it for a long time until I asked around what to do.) I have seen plenty of /doc pages that have the full new doc headers and footers on the /doc page but just a {{/doc}} on the locked template page. And often no template that told about the page lock and how to ask for edits to be done.
  • If the template has a "/sandbox" and "/testcases" it adds links to those.

And by the way, why do you do changes on a guide like this without first discussing it on the talk page?

--David Göthberg 00:16, 15 September 2007 (UTC)

{{template doc page}}

I made a new template to simplify the template documentation. That is, to simplify it for those that use this system.

{{template doc page}}

See the description and documentation code examples there. If no one protests I will modify this how-to guide to use this new template instead of the two old ones in some day.

--David Göthberg 08:10, 18 September 2007 (UTC)

Just realised no one has answered anything I written here for a month. So I went ahead and did the change. --David Göthberg 12:55, 18 September 2007 (UTC)

Komusou edits

Komusou: You seem to be doing a major rework of this page and the templates used to do template documentation. I see that you do edits that break things and your edits show that you don't understand several of the technical details here. And you do all this without discussing it on this talk page first. Also, I disagree with several of the non-technical changes that you have done. Please discuss things first before doing this kind of major overhaul. Changes you do here do affect a lot of pages since people are using this guide all the time, so any mistake you do gets stuck on template pages that gets edited while your mistakes are in the guide.

Unfortunately I don't have the time right now to explain all the details but I'll get back to you. I am very tempted to simply revert all your edits since that would be the quickest fix to get this guide and its templates into working order again.

--David Göthberg 04:08, 26 September 2007 (UTC)

What's the problem? Most edits I made were minor or cosmetic changes, and to documentation text, not "major rework" or "major overhaul", nothing that required lengthy palavers. I usualy edit in steps and fully document in edit summary, so that it's easier to see what I do and why, or to selectively undo a problematic edit. If you did "see edits that break things", why didn't you copy-pasted at the same time the diff URLs that you saw as problems, and named the actual pages/template you're talking about, instead of vague accusations?
Furthermore I make tests, and do not make big changes to live template code without discussing. For instance see your {{Template doc page}}, I proposed a version 2.0 extension for what's currently missing, but I did it all in the /sandbox and /testcases, and I detailed at length the three proposed changes and code at Template talk:Template doc page – I did not immediately dump it on the live template.
So, I don't recognize myself in the wrecker kamikaze you portrays here. This is not the Guantanamo courts, so please show evidence, I might at least learn something and share your outrage. — Komusou talk @ 07:25, 27 September 2007 (UTC)

Merge of documentation templates

I'd like to draw some attention towards a proposed merge between {{Template doc}} and {{Documentation}}. Comment here: Template talk:Template doc#Merge Template:Documentation and Template:Template doc. +mt 08:11, 7 October 2007 (UTC)

The merge took place. {{Documentation}} won. --AlastairIrvine (talk) 16:09, 9 March 2008 (UTC)

There appears to be a new contender, being {{Documentation, template}}. --AlastairIrvine (talk) 16:09, 9 March 2008 (UTC)

Instructions for interwiki bots owners

An Italian interwiki bot has been breaking some templates (mostly adding iw in the transcluded section), but also demonstrating how interwiki bots will have trouble with the doc page pattern. Interwikis and iw bots are useful, so IMO this is something to think about. Two thoughts:

  • I've notified the bot owner of his being blocked and why, with a longish crash-course on the many avatars of WP:DOC and detecting doc subpages at it:Discussioni utente:Alleborgo#Bot en:User:AlleborgoBot suspended for breaking templates (for future reference)
    • Anyone is free to complete/correct my explanations over there so as to get better working bots.
    • The text over there could become the start of a documentation somewhere here, "Instructions for interwiki bots owners", since it's going to become a recurrent problem.
  • Maybe something can be done to improve {{Documentation}} or the way to use it so as to facilitate the work of interwiki bots, especially for helping their algorithm detect where to add the interwikis OR NOT (when a doc page is trancluded on multiple templates, the bot shoudn't follow to the documentation page but either add the interwikis to the template directly, or leave a notification on talk page). I dunno what, maybe some conventional keyword or hidden HTML comment added for the special cases, that would help iw bots know what to do in those special cases.

— Komusou talk @ 18:00, 11 October 2007 (UTC)

This page has been ruined

this and the current page bear virtually no resemblance to the purpose of the original page Template doc page pattern page. 'this' itself may have lost some of the information... that is now totally obscured by what is here on "Template documentation".

Someone needs to restore the original content and split the history and original page name[1]. WP:DPP was the original mnemonic shortcut so that can be kept with the resurrected page, but the "Template documentation" page as it currently stands is not the technical method the original page was written to be. If the information is there at all, it is well hidden. I see no link to the talk discussion involving Tim!, CDB, and then Liguleum.

http://en.wikipedia.org/wiki/Wikipedia:Template_doc_page_pattern [Ah, what the hell -- I restored the page from the Meta copy plus a better intro. Let it be the "Here's why we do this" page it was written to be, and you guys do whatever this page does.]

As I was the person pressing for 'displayed' documentation that lead to the (questions of Tim... that lead to the...) development of this method by CBDunkerson (just over a year ago!), I've no problem with you guys standardizing and cleaning up template documentation--it is in fact one of the stated purposes when I started the WP:TSP project.

But I have a major problem that your renamed page lost the reasons for doing the method, and morphed into a spoon-feeding of naif editors, vice a clear method for the technically savvy.

Feel free to hijack that 'TSP' and rename to "template standardization project" or some such, but this former technical reference needs restored. Best regards, // FrankB 21:07, 12 October 2007 (UTC)