Difference between revisions of "Template:Icon"
m (Margin) |
(Added category. Hope it's pertinent.) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | <!--> A simple concat string case dependant <--> | + | <!--> A simple concat string case dependant. Margin order counter clockwise = Top, Right, Bottom, Left <--> |
<div style= {{ #switch:{{{2}}} | <div style= {{ #switch:{{{2}}} | ||
− | | 1 = "clear:left; float: left; align: top; margin: | + | | 1 = "clear:left; float: left; vertical-align:top; margin:4px 8px 8px 4px; |
− | | 2 = "clear:center; float: center; align: center; margin: | + | | 2 = "clear:center; float: center; vertical-align:top; align: center; margin:4px 8px 8px 8px; |
− | | 3 = "clear:right; float: right; align: top; margin: | + | | 3 = "clear:right; float: right; vertical-align:top; margin:4px 4px 8px 8px; |
− | | 4 = "clear:left; float: left; | + | | 4 = "clear:left; float: left; vertical-align:middle; margin:8px 8px 8px 4px; |
− | | 5 = "clear:center; float: center; | + | | 5 = "clear:center; float: center; vertical-align:middle; halign: center; margin:8px 8px 8px 8px; |
− | | 6 = "clear:right; float: right; align: | + | | 6 = "clear:right; float: right; vertical-align:middle; margin:8px 4px 8px 8px; |
− | | 7 = "clear:left; float: left; align: bottom; margin: | + | | 7 = "clear:left; float: left; vertical-align:bottom; margin:8px 8px 4px 4px; |
− | | 8 = "clear:center; float: center; | + | | 8 = "clear:center; float: center; vertical-align:bottom; margin:8px 8px 4px 8px; |
− | | 9 = "clear:right; float: right; align: bottom; margin: | + | | 9 = "clear:right; float: right; vertical-align:bottom; margin:8px 4px 4px 8px; |
}} | }} | ||
">[[Image: {{ #switch:{{{1}}} | ">[[Image: {{ #switch:{{{1}}} | ||
Line 22: | Line 22: | ||
| Wiki = Book | | Wiki = Book | ||
| Edit <!--> The default value. Keep it at the end of the list ! <--> | | Edit <!--> The default value. Keep it at the end of the list ! <--> | ||
− | }}.png|{{{3}}}px]]</div> | + | }}.png|{{{3}}}px]]</div> <noinclude> |
− | |||
− | |||
This template use the #switch function of the [http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions ParserFunctions extension]. | This template use the #switch function of the [http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions ParserFunctions extension]. | ||
Line 133: | Line 131: | ||
− | <noinclude>[[Category:Wiki Templates]]</noinclude> | + | <noinclude>[[Category:Wiki Templates]] [[Category:Icons]]</noinclude> |
Latest revision as of 09:29, 1 June 2009
This template use the #switch function of the ParserFunctions extension.
General syntax is : <div style="{{{Position}}}">[[Image:{{{1}}}.png|{{{3}}}px]]</div>
For parameter 2 (position) only values 1 & 3 actually works. Valid expressions Left Right Unvalid expressions Center Middle Top Bottom
I see no reason for that I couldn't work. So you can :
- Help me.
- Be patient.
- Explain briefly why I could never be valid. or make me discover another existing simple syntax for this possibility.
Help
This template use three (numbered=default) parameters :
- 1. Module
- Seven values available
- Displayed below. To permit another icon it need to be registered in this template.
- 2. Position
Nine values from 1 to 9
|
|
- 3. Size in pixels
- Optional, thus in third position. Max size if ignored.
- Examples in table cells
2nd Parameter: Position. Mapping : | An example of call with Calc : | No template called here : | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
{{Icon|Calc|3|40}} |
The result is now a 40 pixels floating Calc icon, at the top right of the cell... The result is now a 40 pixels floating Calc icon, at the top right... | |||||||||||
Nine real examples ordered by position (Template calls) | |||||||||||||
Impress icon is called with |
The icon for Math, 60 pixels top-centered. Call |
| |||||||||||
|
|
| |||||||||||
|
|
|