Wikipedia:模板限制
维基百科,自由的百科全书
蒂姆•斯塔林於2006年8月14日在英語維基百科上實施並啟用一個新的嘗試「限制模板的引用」。其為對一個頁面上能夠引用的大小做出限制(不包含頁面上直接呈現的部分)。最重要的是「展開前的大小 pre-expand include size」有了新的限制為2MB(原本是1MB,請參見英文版的討論頁)。
目录 |
[编辑] 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.
[编辑] Inclusion
Text inside <noinclude> sections or outside <includeonly> sections of templates do add to 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].
[编辑] 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 "Template:X0" does not.
Accordingly the first causes [2] and [3] to consider the page 123 transcluded in this page, while the second does not.
[编辑] 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).