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_length_get
.
size
- Use entry point
size
to emit the section table:
{{#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 table'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}}
section_length_get
- Use entry point
section_length_get
to return an article or section length statistic:
{{#invoke:Section sizes|section_length_get|<page name>|<section name>}}
{{#invoke:Section sizes|section_length_get|<page name>|<section name> |_all}}
{{#invoke:Section sizes|section_length_get|<page name>|<section name> |_all |_pct=yes |_nosep=yes}}
{{#invoke:Section sizes|section_length_get|<page name>|<token>}}
Entry point section_length_get()
takes one to three positional arguments from frame
, and two named arguments:
<page name>
(required) – the first positional parameter is the page name; may include namespace<section name>
(optional) – the second positional parameter is either the section name, or one of three tokens (if param 2 is absent, the default is _lead)<sectionName>
– returns the length of the given section_lead
– returns the length of the lead section (this is the default, if param 2 is absent)_max
– returns the length of the longest section_total
– returns the length of the article (should = {{PAGESIZE}} )
<scope>
(optional) – the third positional parameter is the scope of the length measure; if the value_all
is passed, all subsections of the section whose name is given in parameter 2 are included in the length (optional; default: subsections excluded)
Named parameters
_nosep=yes
(optional) – if present, length is emitted without a thousands separator (default: with separator)_pct=yes
(optional) – if present, length is emitted as a percentage of page length, rounded to 2 decimals, with a % symbol appended (default: length is given in bytes)
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