Difference between revisions of "Template:Short"

From FollowTheScore
Jump to: navigation, search
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>
 +
This is not finished yet.
 
==The template==
 
==The template==
 
<pre>{{#ifexpr:{{#len: {{{string|}}} }} > {{#expr:{{{count|25}}}+5}}|{{#sub:{{{string|}}}|0|{{{count|25}}}}}{{{suffix|}}}|{{{string|}}}}}</pre>
 
<pre>{{#ifexpr:{{#len: {{{string|}}} }} > {{#expr:{{{count|25}}}+5}}|{{#sub:{{{string|}}}|0|{{{count|25}}}}}{{{suffix|}}}|{{{string|}}}}}</pre>
Line 11: Line 12:
 
|suffix =
 
|suffix =
 
}}</pre>
 
}}</pre>
*count: optional / default: 25
+
'''*count''': Optional / Default: 25
*suffix: optional / no default for because of wiki markup for URLs
+
:The number of displayed characters. 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 / no default for because of wiki markup for URLs
  
 
;Example URL
 
;Example URL
<pre>[http://en.wikipedia.org/wiki/Mediawiki#Extensions {{Short|string = http://en.wikipedia.org/wiki/Mediawiki#Extensions|count=30}}...]</pre>
+
<pre></pre>
[http://en.wikipedia.org/wiki/Mediawiki#Extensions {{Short{{!}}string=http://en.wikipedia.org/wiki/Mediawiki#Extensions{{!}}count=30}}...]
 
 
</noinclude>
 
</noinclude>

Revision as of 19:09, 23 July 2009

This is not finished yet.

The template

{{#ifexpr:{{#len: {{{string|}}} }} > {{#expr:{{{count|25}}}+5}}|{{#sub:{{{string|}}}|0|{{{count|25}}}}}{{{suffix|}}}|{{{string|}}}}}

Usage

This shortens strings. This can be used to shorten URLs or included text.

Usage
{{Short
|string =
|count  =
|suffix =
}}

*count: Optional / Default: 25

The number of displayed characters. 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 / no default for because of wiki markup for URLs
Example URL