Difference between revisions of "Template:Short"
From FollowTheScore
Line 1: | Line 1: | ||
− | <includeonly>{{#ifexpr:{{#len: {{{string|}}} }} > {{#expr:{{{count|25}}}+5}}|{{#sub:{{{string|}}}|0|{{{count|25}}}}}{{{suffix| …}}}|{{{string|}}}}}</includeonly><noinclude> | + | <includeonly>{{#ifexpr:{{#len: {{{string|}}} }} > {{#expr:{{{count|25}}}+5}}|{{#sub:{{{string|}}}|0|{{{count|25}}}}}{{{suffix| …}}}|{{{string|}}}}}</includeonly><noinclude>__NOTOC__ |
This is not finished yet. | This is not finished yet. | ||
==The template== | ==The template== |
Revision as of 18:29, 23 July 2009
This is not finished yet.
The template
{{#ifexpr:{{#len: {{{string|}}} }} > {{#expr:{{{count|25}}}+5}}|{{#sub:{{{string|}}}|0|{{{count|25}}}}}{{{suffix|}}}|{{{string|}}}{{#if:{{{type|}}|url|]}}}}
Usage
This shortens strings. This can be used to shorten URLs or included text.
Note: Requires Extension:StringFunctions.
Usage
{{Short |string = |count = |suffix = }}
- count: optional / default: 25
- The number of displayed characters (white space / blanks are counted).
- It uses a tolerance of 5. So if you define count=10 the string will not be shortened if it is between 1 and 15 characters long.
- suffix: optional / default: " …" (not ...)
Examples
{{Short|string=The number of displayed characters (white space / blanks are counted).|count=40}}
Result: Expression error: Unrecognized punctuation character "{".
{{Short|string=The number of displayed characters (white space / blanks are counted).|count=500}}
The sring short than the count, nothing happens:
Result: Expression error: Unrecognized punctuation character "{".