Template talk:Newtemplate
Hey Robert,
Questions:
- Is this always required (on your view)?
- If not always, then when?
- What are the rationales for the different sections?
--Larry
- I think this should be on every template (except for subpage article templates, of course), in order to document its usage and instructions. Hopefully this will provide a great level of "ease of use" for all templates (and even encourage development and refinement of existing ones).
- The different sections are intended as documentation; like a "developer notes" or "instructions". Obviously there might be some times when a better or different template should be used, or in cases where you really can't use a template with existing templates. And if something goes wrong with the template, you should know who to go to to have it fixed. --Robert W King 11:32, 13 January 2008 (CST)
Newtemplate and pre-expand sizes
I just saw a number of cases where the {{Newtemplate}} caused a substantial increase in size in the resulting new templates footprint. Using an "example" seemed like it made it particularly bad. Since anything "in" the template page needs to be accessed for every call of the template, shouldn't we put all the documentation stuff on the talk page as a practice?--David Yamakuchi 02:15, 11 April 2008 (CDT)
- It shouldn't be a problem. Look at sodium. There the current numbers are:
- Pre-expand include size: 73527 bytes
- Post-expand include size: 121808 bytes
- Template argument size: 4156 bytes
- I'll revert back and check to see what they are without the newtemplate on the template. Hold on. Chris Day 02:19, 11 April 2008 (CDT)
- The numbers now, on Sodium, without the newtemplate content at the front are:
- Pre-expand include size: 70974 bytes
- Post-expand include size: 121808 bytes
- Template argument size: 4156 bytes
- The only difference is less than 3,000 bytes. A frequently used template might be a problem but the {{Periodic}} and {{Elem Infobox}} are only called once each per element page. Chris Day 02:24, 11 April 2008 (CDT)
- The numbers now, on Sodium, without the newtemplate content at the front are:
See, it does matter...a little. I'm not saying it's a problem, I'm just saying that is info for authors only and doesn't need to be loaded with every page view, right?...--David Yamakuchi 02:27, 11 April 2008 (CDT)
I thought the idea was to slap this thing on every template, period. That seems to me to be an awful lot of loading author, caveats, etc to "end users" that won't even know that they are looking at a template. IDK, seems like Talk is the place for that...no?--David Yamakuchi 02:30, 11 April 2008 (CDT)
- I don't think it is counting the expanded content just the the small amount of literal text that is there. So i don't anticipate a problem with respect to size. I agree if it was counting the expanded content too it would be a real problem. With the {{Elem Infobox}} template the main problem was solved by not calling on the {{ }} template 500 times or more.
- I would have left it on the talk page except there is the NOEDITSECTION issue, and that really does need to be part of the {{newtemplate}} otherwise the edit links go to the wrong place causing a lot of confusion. And, as you found, a talk page with no section edit links is not desirable. The alternative is to have the documentation on a subpage with a link on the main page, especially if the size issue is problematic. Chris Day 02:37, 11 April 2008 (CDT)
{{Elem Infobox}} size with newtemplate:
- Pre-expand include size: 145318 bytes
- Post-expand include size: 313728 bytes
- Template argument size: 76597 bytes
{{Elem Infobox}} size without newtemplate:
- Pre-expand include size: 67880 bytes
- Post-expand include size: 87349 bytes
- Template argument size: 5482 bytes
The fact that only 2500 bytes are added to the pre-expand size of the sodium article indicates that it is literally only the characters on the page that are added. None of the expanded content is counted. Or is that small amount still something to worry about? I think it is only a problem for a template that is used hundreds of times on a given page. Chris Day 02:48, 11 April 2008 (CDT)
- It's not so much the one particular instance, it's the idea that the standard practice will be to "call" this template every time any template is called...anywhere in CZ. That doesn't seem to me like maybe what we want. I submit that a better approach is to have the docs on a seperate page that doesn't get called unless someone is looking up the instructions for the template. Talk page seemed logical to me, but as we saw there's the noeditsection issue...--David Yamakuchi 03:08, 11 April 2008 (CDT)
- Wikipedia has adopted the style of putting the documentation for template Foo in Template:Foo/doc, and transcluding it, with the transclusion call inside a <noinclude></noinclude>, for precisely this reason (to reduce the size of the pre-expand; even with the new preprocessor - when we finally get it - it will still make processing faster). I suggest we do the same. J. Noel Chiappa 11:11, 11 April 2008 (CDT)
- That sounds like a decent idea. --Robert W King 11:14, 11 April 2008 (CDT)
- Wikipedia has adopted the style of putting the documentation for template Foo in Template:Foo/doc, and transcluding it, with the transclusion call inside a <noinclude></noinclude>, for precisely this reason (to reduce the size of the pre-expand; even with the new preprocessor - when we finally get it - it will still make processing faster). I suggest we do the same. J. Noel Chiappa 11:11, 11 April 2008 (CDT)
- I think you mentioned this before and I had no clue why it was relevant. Now I understand and stumbled there semi-independantly. This will make Robert's newtemplate a little harder to navigate. I assume since it will be transcluded twice and the noeditsection will hinder finding the /doc page. Or do we just add a manual link at the top of the documentation template on the template main page. Something along the lines of :
- [.......Template:{{BASEPAGENAMEE}}/Doc...... edit link here]
- {{{{BASEPAGENAME}}/Doc}}
- Chris Day 11:21, 11 April 2008 (CDT)
- I think you mentioned this before and I had no clue why it was relevant. Now I understand and stumbled there semi-independantly. This will make Robert's newtemplate a little harder to navigate. I assume since it will be transcluded twice and the noeditsection will hinder finding the /doc page. Or do we just add a manual link at the top of the documentation template on the template main page. Something along the lines of :
- There will probably have to be a link. --Robert W King 11:23, 11 April 2008 (CDT)
- Yes, exactly. That code fragment you wrote above is placed in a template which is called in all other templates, with the call wrapped inside <noinclude></noinclude>. That's what Wikipedia does; you can see a simple example here (the call to pp-template is to put up a box warning that it can't be edited by normal users). Their {{Documentation}} template (you can see it here) is probably way too complicated for us, though.
- I'd call ours {{templatedoc}}, or something, though. Does {{newtemplate}} work when called from a subpage, or would we need a new version for use on /doc pages? J. Noel Chiappa 13:26, 11 April 2008 (CDT)
{{TlDoc}}
I am proposing that {{TlDoc}} always be used for new templates; at present there are two conflicting systems. Please see CZ_Talk:Templates#Documentation. Caesar Schinas 17:31, 4 May 2009 (UTC)
- I agree. Chris Day 17:45, 4 May 2009 (UTC)