Help:Template limits: Difference between revisions

Content deleted Content added
Post-expand include size: Expand list of methods for dealing with PEIS
Line 75:
Pages exceeding the post-expand include size limit are automatically added to [[:Category:{{MediaWiki:post-expand-template-inclusion-category}}]] ([https://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle={{urlencode:Category:{{MediaWiki:post-expand-template-inclusion-category}}}}&cmprop=title%7Ctimestamp&cmlimit=500&cmsort=timestamp&cmdir=desc&format=xml recent additions]).
[[Template:Citations broken from PEIS limit]] may be manually added to the page when citations or templates are broken as a result of the issue. See also [[phab:T189108]].
 
=== Using comments, noinclude and onlyinclude ===
Only data that survives the preprocessor expansion stage is counted towards the post-expand counter. The length of HTML comments in the wikitext (which are not reproduced in the HTML source produced) is not included in the post-expand counter. Code which is either inside a <noinclude> section or outside an <onlyinclude> section does not get expanded, so these sections do not contribute to the post-expand size. This also means that category tags only contribute if they are included (to categorize pages calling the template).
 
===Nested transclusions===
Note that the sizes of the wikitexts of all expanded templates and parser functions are added, even in the case of nesting (see [[phab:T15260]]), so extra levels increase the count. If page A transcludes B and B does nothing but transclude C, then the size of C will be counted ''twice'' towards the post-expand include size on page A, and similarly if a template consists of a parser function call, or a parser function has a template call as parameter, etc. ThisPossible cansubstitutions sometimesto bereduce mitigatednesting by letting the parser function produce a template name instead of a template result, e.g. by replacinginclude:
 
:*<code><nowiki>{{#if:{{{test|}}}|{{template1}}|{{template2}} }}</nowiki></code> replaced with <code><nowiki>{{ {{#if:{{{test|}}}|template1|template2}} }}</nowiki></code>.
with
*{{tl|navboxes}} replaced with {{tl|navboxes top}} and {{tl|navboxes bottom}}
:<code><nowiki>{{ {{#if:{{{test|}}}|template1|template2}} }}</nowiki></code>.
*{{tl|trim|...}} replaced with {{pf|if|1|...}}
 
=== Non-rendered transclusions ===
Non-rendered tranclusions still count towards limit. For example, a page which contains only <code><nowiki>{{#if:{{:Main Page}}}}</nowiki></code> would still have a post-expand include size even though it would have no output at all.
 
The same applies to [[Wikipedia:Lua|Scribunto modules]]. For example, <code><nowiki>{{#invoke:Test|main}}</nowiki></code> would still increase post-expand include size even if Module:Test were simply: <syntaxhighlight lang=lua>mw.getCurrentFrame():preprocess'{{msgnw::Main Page}}' -- remove this line and post-expand include size becomes zero
return { main = function() end } -- p.main() has no return value</syntaxhighlight>
 
=== &#35;invoke syntax ===
Some templates have equivalent Lua modules, which may be transcluded with the syntax <code>&#35;invoke:''module name''</code>. This has lower PEIS than using templates which wrap that Lua module. However, if used directly in articles there is a cost to the readability (and editing) of article source code, so that is discouraged unless strictly necessary. These include:
* {{ml|navbox|navbox|...}}, {{ml|navbox with collapsible groups|navbox|...}}, inside navbox templates.
* {{ml|infobox|infoboxTemplate}}, inside infobox templates.
* {{ml|flag|}}, {{ml|flagg|}} for articles with large numbers of flags.
* {{ml|cite web|}}, {{ml|cite news|}}, e.g. where there are several hundred references.
 
=== Splitting articles ===
Ideally the length of articles would be determined by content-related decisions not technical issues. However, if PEIS issues are unresolvable on an article such as a long list, it may be split into sections which each fit within the limit.
 
==Template argument size==