Template:Word count/doc
This is a documentation subpage for Template:Word count. It may contain usage information, categories and other content that is not part of the original template page. |
This template uses Lua: |
This template counts the number of words that goes into its first parameter. It serves as a basic word count function in areas where word count is important (such as Arbitration Committee statements, etc.)
Usage
[edit]{{word count|1=[phrase to count]|limit=[number of words to limit?]|trim=[whether to trim?]|showcount=[whether to show the word count?]}|prepend=[what to prepend?]|append=[what to append after?]}}
Examples
[edit]{{word count|
One two three four five six seven
|limit=20|trim=no|showcount=yes}}
Word count: 7/20
One two three four five six seven
{{word count|
One two three four five six seven eight nine ten
eleven twelve
|limit=20|trim=yes|showcount=yes}}
Word count: 12/20
One two three four five six seven eight nine ten
eleven twelve
{{word count|
One two three four five six seven eight nine ten
eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty
|limit=20|trim=yes|showcount=yes}}
Word count: 20/20
One two three four five six seven eight nine ten
eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty
{{word count|
One two three four five six seven eight nine ten
eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty twenty-one twenty-two
|limit=20|trim=yes|showcount=yes}}
Word count: 22/20
One two three four five six seven eight nine ten
eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty
{{word count|
One two three four five six seven eight nine ten
eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty twenty-one twenty-two
|trim=yes|showcount=yes}}
Word count: 22
One two three four five six seven eight nine ten
eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty twenty-one twenty-two
Parameter trim= example showing all text (trim=no) or truncated text (trim=yes)
[edit]{{word count|prepend=<div style="border:1px solid red;">|
One two three four five six seven eight nine ten
eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty twenty-one twenty-two
|append=</div>|limit=20|trim=no|showcount=yes}}
Word count: 22/20
{{word count|prepend=<div style="border:1px solid red;">|
One two three four five six seven eight nine ten
eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty twenty-one twenty-two
|append=</div>|limit=20|trim=yes|showcount=yes}}
Word count: 22/20
Possible errors
[edit]The |trim=yes
option truncates text at a word boundary, which may leave formatting markup unclosed. This can affect formatting of text that follows the template text, and can cause Linter errors.
See also
[edit]- {{Count}} – To count the parameters of a template
- {{InternalLinkCounter}} – To count number of internal links