Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

Jump to content

Template:Section length/doc

From Wikipedia, the free encyclopedia

Returns the length of a given section of a page, the size of the longest section, or the size of the article.

Usage

[edit]

{{section length|Article|Section}}
{{section length|Article|Section|nosep=y}}
{{section length|Article|Section|pct=y}}
{{section length|Article|token}}
{{section length|Article}}

Parameters

[edit]

There is one required parameter, and four optional parameters:

  • |1= – the name of the article or page (required)
  • |2= – the section name, or a token with leading underscore (optional; if absent, _lead is the default):
    |2=SectionName – returns the length of the given section
    |2=_lead – returns the length of the lead section (default if param 2 is absent)
    |2=_max – returns the length of the longest section
    |2=_total – returns the length of the article (should = {{PAGESIZE}})
  • |3=_all – with param 2 set to a section name, add this to return section size including all its subsections (optional; default: return only the length before the first subsection heading)
  • |pct= – set to any non-empty value, returns section length as percent of article length, rounded to 2 decimal places (optional)
  • |nosep= – set to any non-empty value, returns byte length without thousand separators (optional; default: with separators)

Examples

[edit]
  • {{section length|World War II|Background}} → 50      – length in bytes of World War II#Background excluding subsections
  • {{section length|World War II|Background|_all}} → 8,265      – length of World War II#Background including all subsections
  • {{section length|World War II|_total}} → 250,060      – total length of World War II
  • {{section length|World War II|nosep=y|_total}} → 250060      – as above, without the comma
  • {{section length|World War II|_lead}} → 9,773      – length in bytes of the lead
  • {{section length|World War II|_lead|pct=y}} → 3.91%      – length of the lead as a percent of article length
  • {{section length|World War II|pct=y}} → 3.91%      – same as above; param 2 is optional
  • {{section length|World War II|_max}} → 68,941      – length in bytes of longest section
  • {{section length|France|_total}} → 281,450      – total length in bytes of France
  • {{section length|France|_lead}} → 18,860      – length of the lead section in bytes
  • {{section length|France}} → 18,860      – same as above; param 2 is optional
  • {{section length|France|pct=y}} → 6.70%      – length of the lead section as a percent of article length
  • {{section length|France|Environment}} → 14,026      – length of France#Environment
  • {{section length|France|Environment|nosep=y}} → 14026      – same, without thousands separator
  • {{section length|France|Environment|pct=y}} → 4.98%      – length of section as a percent of article length
  • {{section length|France|Whoopsie!|pct=y}}      – when the section doesn't exist
  • {{section length|Franceee|pct=y}}error: no article: Franceee (help)      – when the article doesn't exist

See also

[edit]