Help:Template limits: Difference between revisions

Content deleted Content added
 
(6 intermediate revisions by 4 users not shown)
Line 77:
 
== Post-expand include size ==
{{shortcut|WP:PEIS}}{{Tracked|T275319|open}}{{Tracked|T189108|open}}
The '''post-expand include size''' is the sum of the lengths of the expanded wikitexts generated by templates, parser functions and variables. Whenever the parser is instructed by the source code of a page to expand a template etc. (that is, to replace it by transclusion or substitution), the parser adds together the length of the expanded wikitext generated by the template etc. and the current counter value of the page. If this sum is more than the '''post-expand limit''' (same as the [[WP:CHOKING|max article size limit]]), the initial template etc. is not replaced and an error message is added as a comment in the output HTML. Otherwise the post-expand counter is increased to the new value, and parsing continues. A template that is expanded more than once in the page contributes more than once to its post-expand include size.
 
The '''post-expand include size''' is the sum of the lengths of the expanded wikitexts generated by templates, parser functions and variables. Whenever the parser is instructed by the source code of a page to expand a template etc. (that is, to replace it by transclusion or substitution), the parser adds together the length of the expanded wikitext generated by the template etc. and the current counter value of the page. If this sum is more than the '''post-expand limit''' (same as the [[WP:CHOKING|max article size limit]]; see <code>[[mw:Manual:$wgMaxArticleSize|$wgMaxArticleSize]]</code>), the initial template etc. is not replaced and an error message is added as a comment in the output HTML. Otherwise the post-expand counter is increased to the new value, and parsing continues. A template that is expanded more than once in the page contributes more than once to its post-expand include size.
Template invocations with no arguments have an expanded text cache. So if <code><nowiki>{{foo}}</nowiki></code> includes the second-level meta-template <code><nowiki>{{bar}}</nowiki></code>, then multiple invocations of <code><nowiki>{{foo}}</nowiki></code> will only increment the post-expand include size for the fully-expanded <code><nowiki>{{foo}}</nowiki></code>; the secondary include <code><nowiki>{{bar}}</nowiki></code> is only counted once. But if you included the same template multiple times with <code><nowiki>{{foo|arg}}</nowiki></code>, then the secondary templates are counted each time, even if the argument is the same.
 
Template invocations with no arguments have an expanded text cache. So if <code><nowiki>{{foo}}</nowiki></code> includes the second-level meta-template <code><nowiki>{{bar}}</nowiki></code>, then multiple invocations of <code><nowiki>{{foo}}</nowiki></code> will only increment the post-expand include size for the fully-expanded <code><nowiki>{{foo}}</nowiki></code>; the secondary includeinclusion <code><nowiki>{{bar}}</nowiki></code> is only counted once. But if you included the same template multiple times with <code><nowiki>{{foo|arg}}</nowiki></code>, then the secondary templates are counted each time, even if the argument is the same.
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]].
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.
 
=== Using comments, noinclude and onlyinclude ===
Line 97:
 
=== Non-rendered transclusions ===
Non-rendered tranclusions still count towards limit. For example, a page which contains only <code><nowikisyntaxhighlight lang="wikitext" inline>{{#if:{{:Main Page}}}}</nowiki></codesyntaxhighlight> 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><nowikisyntaxhighlight lang="wikitext" inline>{{#invoke:Test|main}}</nowiki></codesyntaxhighlight> 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>
 
Line 108:
* {{ml|infobox|infoboxTemplate}}, {{ml|infobox3cols|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.
* {{ml|episode table|main}}, {{ml|episode list|}} for episode lists.
 
Line 122:
Example:
 
<code><nowiki>{{tlx|3x|{{tlp|2x|abcde}}}}</nowiki></code> has a template argument size of 40 bytes: the argument <code>{{2x|abcde}}</code> is counted 3 times, the argument <code>abcde</code> twice.
 
Arguments in the template call which do not match any parameter tag in the template do not count.
Line 136:
 
== Expensive parser function calls ==
{{Redirect|WP:EXPENSIVE|the essay "Redirects are costly"|WP:COSTLY}}{{Further|mw:Manual:$wgExpensiveParserFunctionLimit|Template:Expensive}}{{shortcut|WP:EXPENSIVE}}
{{shortcut|WP:EXPENSIVE}}
 
There is a limit of 500 to the '''expensive parser function count''', i.e., the number of calls of expensive [[:mw:Help:Magic words#Parser functions|parser functions]], which are:
* <code>[[Help:Magic words#Conditional|#ifexist]]<nowiki /code>ifexist: [[Help:Conditional expressions|conditional expression]] which branchingbranches depending on whether a particulargiven page exists or not. If the limit on thisexpensive counterparser functions is exceeded, every additional <code>#ifexist</code> callscall will actbehave as though the pagesgiven theypage in the query dodoes not exist.
* [[mw:Help:<code>{{Magic words#Statisticsword|PAGESINCATEGORY]]}}</code> or PAGESINCAT: Number of pages in the category named ''categoryname''. Each subcategory is counted as one item.
* [[mw:Help:Magic words#Technical metadata|PAGESIZE]]
* CASCADINGSOURCES