Module:Section sizes/doc
![]() | This is a documentation subpage for Module:Section sizes. It may contain usage information, categories and other content that is not part of the original module page. |
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.
Usage
This module has two entry points: size
, and section_size_get
.
size
Use entry point size
to emit the section wikitable:
{{#invoke:Section sizes|size|<page name>|style=<style string>}}
Entry point size()
takes two arguments from frame
, one positional and one named:
<page name>
(required) – the first positional parameter is the page name; may include namespace|style=
(optional) – css string suitable for use in the wikitable'sstyle=
attribute; for example to render the table at the right side of the page:{{#invoke:Section sizes|size|<page name>|style=float:right; margin-left:.5em}}
Example
<syntaxhighlight lang="wikitext" inline="1">
Section name | Byte count |
Section total |
---|---|---|
Beginning | 5,081 | 5,081 |
History | 4,102 | 4,102 |
Language | 4,730 | 4,730 |
Speakers | 8,574 | 8,574 |
Real world usage | 1,586 | 1,586 |
Use in other media | 8,008 | 10,194 |
Language learning sources | 2,186 | 2,186 |
Canon | 1,966 | 2,388 |
Internal history | 422 | 422 |
Phonology | 4,931 | 12,216 |
Consonants | 3,338 | 3,338 |
Vowels | 2,327 | 2,327 |
Syllable structure | 730 | 730 |
Stress | 890 | 890 |
Grammar | 3,826 | 3,826 |
Writing systems | 4,316 | 4,316 |
Vocabulary | 2,134 | 2,134 |
Example sentences | 481 | 481 |
See also | 386 | 386 |
Notes | 26 | 26 |
References | 28 | 28 |
Bibliography | 908 | 908 |
External links | 3,131 | 3,131 |
Total | 64,107 | 64,107 |
</syntaxhighlight>
![]() |
|
section_size_get
section_size_get
return an article or section size statistic:
{{#invoke:Section sizes|section_size_get|<page name>|[<section name|token>]|_all|_pct=yes |_nosep=yes}}
section_size_get
takes one to three positional parameters and two named parameters from frame
:
<page name>
(required) – the first positional parameter is the page name; may include namespace<section name|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)<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<section name>
; not supported for keywords; returns size of the named section plus the sizes of its subsections
Named parameters
|_nosep=
(optional) – no separator; accepts one value:yes
; section size emitted without thousands separators; ignored when|_pct=
is set (default: with separator)|_pct=
(optional) – percent; accepts one value:yes
; emits size of<section name>
,_lead
,_max
, or_total
as a percentage of_total
rounded to 2 decimals with a '%' symbol
Examples
These examples refer to the same article as shown in the size
example.
Sizes of a named section with and without its subsections (_all
):
- <syntaxhighlight lang="wikitext" inline="1">4,931</syntaxhighlight> → 4,931
- <syntaxhighlight lang="wikitext" inline="1">12,216</syntaxhighlight> → 12,216
Keywords:
- <syntaxhighlight lang="wikitext" inline="1">5,081</syntaxhighlight> → 5,081
- <syntaxhighlight lang="wikitext" inline="1">8,574</syntaxhighlight> → 8,574
- <syntaxhighlight lang="wikitext" inline="1">64,107</syntaxhighlight> → 64,107
Section sizes without thousands separator:
- <syntaxhighlight lang="wikitext" inline="1">4931</syntaxhighlight> → 4931
- <syntaxhighlight lang="wikitext" inline="1">64107</syntaxhighlight> → 64107
Section sizes as a percentage of _total
:
- <syntaxhighlight lang="wikitext" inline="1">7.69%</syntaxhighlight> → 7.69%
- <syntaxhighlight lang="wikitext" inline="1">7.93%</syntaxhighlight> → 7.93%
- <syntaxhighlight lang="wikitext" inline="1">13.37%</syntaxhighlight> → 13.37%
- <syntaxhighlight lang="wikitext" inline="1">100.00%</syntaxhighlight> → 100.00%
See also
- Template:Section sizes, a pre-styled template for talk pages which invokes this module
- Template:Section length, a simple template which invokes it to request the length of one named section, or related info