Wikipedia:Template limits

From Wikipedia, the free encyclopedia

Tim implemented and enabled a trial of new limits for template inclusion for the English Wikipedia on 14 August 2006. These are limits on how much can be included in a page (i.e., not counting what is directly on the page). The most important part of these new limits is the pre-expand include size, which is limited to 2MB (originally 1MB, see also the talk page).

Contents

[edit] Metrics

The HTML source of pages includes an HTML comment with the values of the inclusion size counters if the 'Pre-expand include size' is greater than one-thousand bytes. As an example, the page AIDS (as of writing this) contains the following in its generated HTML source:

<!-- 
Pre-expand include size: 369755 bytes
Post-expand include size: 140755 bytes
Template argument size: 117643 bytes
Maximum: 2048000 bytes
-->

Note that sub-templates are cumulative in the calculation of the pre-expand include size. If template A contains {{b}}{{b}}{{b}}{{b}}{{b}} and template B is 100 bytes long, then the total pre-expand include size of {{a}} is the size of template A (25 bytes) plus five times the size of template B - 525 bytes total. However, if template A instead contained <noinclude>{{b}}{{b}}{{b}}{{b}}{{b}}</noinclude> its pre-expand include size would be just 48 bytes, because sub-templates within unincluded sections are not evaluated.

[edit] Inclusion

Text inside <noinclude> sections or outside <includeonly> sections of templates is counted when calculating the pre-expand size. However, calls to other templates in such sections are evaluated based on their 'unexpanded' size. Tim proposes to transclude template documentation from a subpage [1].

See Wikipedia:Template doc page pattern.

[edit] Conditional inclusion

Whether conditional inclusion counts as inclusion even if the condition is false depends on the syntax, e.g. {{#ifexpr:0|{{:123}}}}, giving "", counts as inclusion of the 123 article, but {{ {{#ifexpr:0|:123|x0}} }} giving "" does not.

Accordingly the first causes [2] and [3] to consider the page 123 transcluded in this page, while the second does not.

[edit] Special:ExpandTemplates

Tim also created a related new special page ExpandTemplates at Special:ExpandTemplates. It is used to manually expand wikitext containing template calls. The calls are recursively expanded to their plain wiki-text. Special:ExpandTemplates also recursively expands all ParserFunction calls — something that cannot be achieved with substitution (see also bug 2227).

[edit] References