This module creates a wikitable that lists each section in a page along with that section's size in bytes. Each section is wikilinked to its target in the page; subsections are indented. Cells for section sizes are shaded according to the size; the smallest section's background is white, and the largest section's background is red.
This module has two entry points: size
, and section_size_get
.
size
Use entry point size
to emit the section wikitable:
{{((}}#invoke:{{BASEPAGENAME}}|size|<{{var|page name}}>|style=<{{var|style string}}>}}
Entry point size
takes two arguments from frame
, one positional and one named:
<{{var|page name}}>
(required) – the first positional parameter is the page name; may include namespacestyle=
attribute; for example to render the table at the right side of the page:<nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|size|<{{var|page name}}>|style=float:right; margin-left:.5em}}
section_size_get
section_size_get
return an article or section size statistic:
{{((}}#invoke:{{BASEPAGENAME}}|section_size_get|<{{var|page name}}>|[<{{var|section name}}{{!}}{{var|token}}>]|_all|_pct=yes |_nosep=yes}}
section_size_get
takes one to three positional parameters and two named parameters from frame
:
<{{var|page name}}>
(required) – the first positional parameter is the page name; may include namespace<{{var|section name}}{{!}}{{var|token}}>
(optional) – the second positional parameter is either the section name, or one of three tokens (if param 2 is absent, the default is the article's lead section)<{{var|section name}}>
– returns the size of the named section
_lead
– returns the size of the lead section; default when second positional parameter is empty or omitted
_max
– returns the size of the longest individual section
_total
– returns the size of the article (should equal PAGESIZE)
_all
(optional) – the third positional parameter is the scope of the size measure; requires <{{var|section name}}>
; not supported for keywords; returns size of the named section plus the sizes of its subsectionsyes
; section size emitted without thousands separators; ignored when is set (default: with separator)yes
; emits size of <{{var|section name}}>
, _lead
, _max
, or _total
as a percentage of _total
rounded to 2 decimals with a '%' symbolThese examples refer to the same article as shown in the size
example.
Sizes of a named section with and without its subsections (_all
):
Keywords:
Section sizes without thousands separator:
Section sizes as a percentage of _total
: