GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Main page
  • Contents
  • Current events
  • Random article
  • About Wikipedia
  • Contact us
  • Help
  • Learn to edit
  • Community portal
  • Recent changes
  • Upload file
  • Special pages
  • Search
  • Donate

This view

  • Original page
  • New address

GeezerVison is showing en.wikipedia.org — Template:Section length - Wikipedia

21,060

Template documentationviewedithistorypurge
This template uses Lua:
  • Module:Section sizes (sandbox)
This template is rated as beta. It is considered ready for widespread use, but as it is still relatively new, it should be applied with some caution to ensure results are as expected.

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

Usage

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

Parameters

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

  • {{section length|World War II|Background}} → 50      – length in bytes of World War II#Background excluding subsections
  • {{section length|World War II|Background|_all}} → 7,692      – length of World War II#Background including all subsections
  • {{section length|World War II|_total}} → 247,510      – total length of World War II
  • {{section length|World War II|nosep=y|_total}} → 247510      – as above, without the comma
  • {{section length|World War II|_lead}} → 10,056      – length in bytes of the lead
  • {{section length|World War II|_lead|pct=y}} → 4.06%      – length of the lead as a percent of article length
  • {{section length|World War II|pct=y}} → 4.06%      – same as above; param 2 is optional
  • {{section length|World War II|_max}} → 69,536      – length in bytes of longest section
  • {{section length|France|_total}} → 281,945      – total length in bytes of France
  • {{section length|France|_lead}} → 21,060      – length of the lead section in bytes
  • {{section length|France}} → 21,060      – same as above; param 2 is optional
  • {{section length|France|pct=y}} → 7.47%      – length of the lead section as a percent of article length
  • {{section length|France|Environment}} → 14,070      – length of France#Environment
  • {{section length|France|Environment|nosep=y}} → 14070      – same, without thousands separator
  • {{section length|France|Environment|pct=y}} → 4.99%      – 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

  • Module:Section sizes
  • Template:Section sizes
The above documentation is transcluded from Template:Section length/doc. (edit | history)
Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:Section_length&oldid=1247154893"
Categories:
  • Templates in beta
  • Wikipedia formatting templates
Hidden category:
  • Lua-based templates
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.