Content deleted Content added
m Synoman Barris moved page Wikipedia:Template limits to Help:Template limits: Requested by Extraordinary Writ at WP:RM/TR: Per RM closure at Special:PermaLink/1079258876#Requested move 18 March 2022. Fully move-protected; sysop needed. Tag: Disambiguation links added |
|||
(32 intermediate revisions by 20 users not shown) | |||
Line 1:
{{pp-vandalism|small=yes}}{{pp-move-indef}}
{{infopage|WP:TLIMIT|H:TLIMIT}}▼
▲{{infopage|WP:TLIMIT}}
The [[MediaWiki]] software that powers Wikipedia has several parameters that limit the complexity of a page, and the amount of data that can be included. These limits mainly concern data that is [[Wikipedia:Transclusion|transcluded]] or [[Wikipedia:Substitution|substituted]] during expansion of a page, as opposed to data directly in the source of the page itself. This page explains how and why these limits are applied, and how users can work within the limits.
Line 15 ⟶ 14:
===Working within the limits===
When a page reaches the template limits, the most common solution is to make the templates shorter, using methods described below. If this isn't possible, it may be necessary to include more data directly in the page source, rather than transcluding it from templates (e.g., formatting references by hand or using <code><nowiki><references /></nowiki></code> instead of
===When do problems arise?===
Line 22 ⟶ 21:
===How can you find out?===
Once the page body is processed, an HTML comment is added towards the end of the HTML code of the page with the final values of the various counters. For example, the page [[HIV/AIDS]] (on
<syntaxhighlight lang="
<!--
NewPP limit report
Parsed by mw1416
Preprocessor node count: 173488/1000000▼
Cached time: 20231227101515
Post-expand include size: 1557895/2048000 bytes▼
Cache expiry: 2592000
Template argument size: 561438/2048000 bytes▼
Reduced expiry: false
Highest expansion depth: 29/40▼
Complications: [vary‐revision‐sha1, show‐toc]
Expensive parser function count: 7/500▼
Real time usage: 3.151 seconds
Unstrip recursion depth: 1/20
Unstrip post‐expand size: 1121339/5000000 bytes
Lua time usage: 1.705/10.000 seconds
Lua Profile:
MediaWiki\Extension\Scribunto\Engines\LuaSandbox\LuaSandboxCallback::preprocess 180 ms 10.6%
? 160 ms 9.4%
MediaWiki\Extension\Scribunto\Engines\LuaSandbox\LuaSandboxCallback::callParserFunction 140 ms 8.2%
MediaWiki\Extension\Scribunto\Engines\LuaSandbox\LuaSandboxCallback::plain 140 ms 8.2%
MediaWiki\Extension\Scribunto\Engines\LuaSandbox\LuaSandboxCallback::gsub 80 ms 4.7%
MediaWiki\Extension\Scribunto\Engines\LuaSandbox\LuaSandboxCallback::find 80 ms 4.7%
dataWrapper <mw.lua:672> 80 ms 4.7%
select_one <Module:Citation/CS1/Utilities:426> 80 ms 4.7%
recursiveClone <mwInit.lua:41> 80 ms 4.7%
<mwInit.lua:41> 60 ms 3.5%
[others] 620 ms 36.5%
Number of Wikibase entities loaded: 0/400
-->
</syntaxhighlight>
(Some items may not be present on other wikis, depending on which extensions they have installed; for example, the "Lua" items are added by [[mw:Extension:Scribunto|Extension:Scribunto]].)
Because of the way the counters are increased, the
▲Lua time usage: 0.331s
▲Lua memory usage: 1.25 MB
Click "Parser profiling data" at the bottom of a preview to see similar data for the preview without saving it.
Line 69 ⟶ 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
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.▼
▲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]).
=== 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
===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.
*<syntaxhighlight lang="wikitext" inline>{{#if:{{{test|}}}|{{template1}}|{{template2}} }}</syntaxhighlight> replaced with <syntaxhighlight lang="wikitext" inline>{{ {{#if:{{{test|}}}|template1|template2}} }}</syntaxhighlight>.
*{{tl|navboxes}} replaced with {{tl|navboxes top}} and {{tl|navboxes bottom}}
*{{tl|trim|...}} replaced with {{pf|if|1|...}}
*{{tlf|Episode table|episodes{{=}}...}} -> <syntaxhighlight lang="wikitext" inline>{{episode table|dontclose=y}} ... {{End|html=y|Episode table}}</syntaxhighlight>
=== Non-rendered transclusions ===
Non-rendered tranclusions still count towards limit. For example, a page which contains only <
The same applies to [[Wikipedia:Lua|Scribunto modules]]. For example, <
return { main = function() end } -- p.main() has no return value</syntaxhighlight>▼
=== #invoke syntax ===
{{anchor|invoke syntax}}
Some templates have equivalent Lua modules, which may be transcluded with the syntax <code>#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}}, {{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.
=== References ===
Pages may exceed the limit when trying to display references using the {{tl|reflist}} template. Replacing it with <code><nowiki><references /></nowiki></code> may allow the references to appear, although the list may be truncated if the limit is exceeded by templates such as {{tl|cite web}}. As of 2010, the <references /> tag has the same font styling as {{tl|reflist}}, and as of 2017 it allows for responsive columns.
=== Splitting articles ===
▲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
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, following the policy at [[WP:SPLIT]].
▲return {main = function()end}-- p.main() has no return value</syntaxhighlight>
==Template argument size==
Line 96 ⟶ 122:
Example:
Arguments in the template call which do not match any parameter tag in the template do not count.
Line 110 ⟶ 136:
== Expensive parser function calls ==
{{Redirect|WP:EXPENSIVE|the essay "Redirects are costly"|WP:COSTLY}}{{Further|mw:Manual:$wgExpensiveParserFunctionLimit|Template: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
*
* [[mw:Help:Magic words#
* CASCADINGSOURCES
* REVISIONUSER, when used on a page other than the current page
Line 123 ⟶ 148:
** [[mw:Extension:Scribunto/Lua reference manual#mw.site.stats.pagesInCategory|mw.site.stats.pagesInCategory]]
** Some [[mw:Extension:Scribunto/Lua reference manual#Title objects|title object]] properties and methods
* [[mw:Extension:SyntaxHighlight|{{tag|syntaxhighlight}} tags]]
It is also possible to manually increment the expensive parser function count from a Lua module by using [[mw:Extension:Scribunto/Lua reference manual#mw.incrementExpensiveFunctionCount|mw.incrementExpensiveFunctionCount]].
Line 129 ⟶ 155:
See also: [[mw:Manual:$wgExpensiveParserFunctionLimit]], [[Template:Expensive]]
==Unstrip post-expand size==
The '''unstrip post-expand size''' counter tracks the total bytes added via [[Wikipedia:TemplateStyles|TemplateStyles]] (the {{tag|templatestyles|e}} tag itself is counted towards the [[#Post-expand include size|post-expand include size]] count).
==#time==
Line 136 ⟶ 165:
== Special:Expandtemplates ==
When a page exceeds the limits, one crude way to solve the problem is to use [[Special:ExpandTemplates]]. As opposed to [[WP:SUBST|substitution]] it recursively expands all levels at once, without the need of specially preparing the templates with the code <code><nowiki>
==History==
The inclusion limits were put into effect on the English Wikipedia by [[User:Tim Starling|Tim Starling]] on 14 August 2006. A new preprocessor was [[m:Migration to the new preprocessor|enabled in January 2008]], removing the "pre-expand include limit" and replacing it with a "preprocessor node count" limit.
The practice of using a template documentation page, while it can still be useful for other reasons, is no longer needed for avoiding documentation to be counted on pages that call the template.
==References==
* [
* [http://lists.wikimedia.org/pipermail/wikipedia-l/2006-August/027271.html Tim's posting on wikipedia-l]
* [[mw:NewPP parser report]]
|