Difference between revisions of "Template:Icon"

From Apache OpenOffice Wiki
Jump to: navigation, search
m
(Added category. Hope it's pertinent.)
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
<div style=
+
<!--> A simple concat string case dependant. Margin order counter clockwise = Top, Right, Bottom, Left <-->
{{ #switch:{{{2}}}
+
<div style= {{ #switch:{{{2}}}
| 1  = "float: left; align: top;
+
| 1  = "clear:left; float: left; vertical-align:top; margin:4px 8px 8px 4px;
| 2  = "float: center; align: top;
+
| 2  = "clear:center; float: center; vertical-align:top; align: center; margin:4px 8px 8px 8px;
| 3  = "float: right; align: top;
+
| 3  = "clear:right; float: right; vertical-align:top; margin:4px 4px 8px 8px;
| 4  = "float: left; align: center;
+
| 4  = "clear:left; float: left; vertical-align:middle; margin:8px 8px 8px 4px;
| 5  = "float: center; align: center;
+
| 5  = "clear:center; float: center; vertical-align:middle; halign: center; margin:8px 8px 8px 8px;
| 6  = "float: left; align: center;
+
| 6  = "clear:right; float: right; vertical-align:middle; margin:8px 4px 8px 8px;
| 7  = "float: left; align: bottom;
+
| 7  = "clear:left; float: left; vertical-align:bottom; margin:8px 8px 4px 4px;
| 8  = "float: center; align: bottom;
+
| 8  = "clear:center; float: center; vertical-align:bottom; margin:8px 8px 4px 8px;
| 9  = "float: left; align: bottom;
+
| 9  = "clear:right; float: right; vertical-align:bottom; margin:8px 4px 4px 8px;
 
}}
 
}}
">[[Image:{{ #switch:{{{1}}}
+
">[[Image: {{ #switch:{{{1}}}
| General
+
| Base = Base
| Installation
+
| Calc = Calc
| Setup
+
| Draw = Draw
| Wiki = Edit
+
| Impress = Impress
 +
| Math = Math
 +
| Writer = Writer
 +
| Book <!--> You can add many words pointing to the same. Keep reference (line with "=") at the end <-->
 +
| Livre
 +
| 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>
  
 
<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].
  
General syntax is : <div style="{{{Position}}}">[[Image:{{{1}}}.png|{{{3}}}px]]</div>  
+
General syntax is : <code><nowiki><div style="{{{Position}}}">[[Image:{{{1}}}.png|{{{3}}}px]]</div></nowiki></code>
 
+
For parameter 2 (position) only values 1 & 3 actually works.
+
  
;Valid expressions
+
For parameter 2 (position) only values 1 & 3 actually works.
:Left
+
    Valid expressions
:Right
+
        Left
;Unvalid expressions
+
        Right
:Center
+
    Unvalid expressions
:Middle
+
        Center
:Top
+
        Middle
:Bottom
+
        Top
 +
        Bottom
  
 
I see no reason for that I couldn't work. So you can :
 
I see no reason for that I couldn't work. So you can :
Line 46: Line 48:
  
 
;1. Module : Seven values available
 
;1. Module : Seven values available
 +
:Displayed below. To permit another icon it need to be registered in this template.
 
;2. Position :  
 
;2. Position :  
 
{|
 
{|
Line 54: Line 57:
 
:::To bottom Right
 
:::To bottom Right
 
|
 
|
{|
+
{| cellpadding="5"
 
|-
 
|-
 
| 1 || 2 || 3
 
| 1 || 2 || 3
Line 71: Line 74:
 
<br>  
 
<br>  
  
{| border="1"  style="width: 800px; height: 120px;"
+
{| border="1"  style="width: 100%;<!--> height: 120px;<-->"
 
|-
 
|-
! 2nd Parameter: Position. Mapping:  
+
! width=="33% | 2nd Parameter: Position. Mapping :  
! The call should be :
+
! width=="33% | An example of call with Calc :
! No template called here :
+
! width=="34% | No template called here :
 
|-
 
|-
 
| <center>
 
| <center>
{| style="width: 360px; height: 90px;"
+
{| style="width: 100%;"
 
|-
 
|-
 
| Nine values from 1 to 9  
 
| Nine values from 1 to 9  
Line 85: Line 88:
  
 
|  
 
|  
{|
+
{| cellpadding="3"
 
|-
 
|-
 
| 1  
 
| 1  
Line 106: Line 109:
 
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...  
 
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...  
 
|-
 
|-
! Colspan=3 | Real examples (Template calls)
+
! bgcolor="#eefbee" Colspan=3 | Nine real examples ordered by position (Template calls)
 
|-
 
|-
 
|{{Icon|Impress|1|120}}
 
|{{Icon|Impress|1|120}}
Line 115: Line 118:
 
<code><nowiki>{{</nowiki>Icon|Base|3|80}}</code> Give a floating icon for Base, 80 pixel sized, top right aligned. <code><nowiki>{{</nowiki>Icon|Base|3|80}}</code> Give a floating icon for Base, 80 pixel sized, top right aligned. <code><nowiki>{{</nowiki>Icon|Base|3|80}}</code> Give a floating icon for Base, 80 pixel sized, top right aligned.  
 
<code><nowiki>{{</nowiki>Icon|Base|3|80}}</code> Give a floating icon for Base, 80 pixel sized, top right aligned. <code><nowiki>{{</nowiki>Icon|Base|3|80}}</code> Give a floating icon for Base, 80 pixel sized, top right aligned. <code><nowiki>{{</nowiki>Icon|Base|3|80}}</code> Give a floating icon for Base, 80 pixel sized, top right aligned.  
 
|-
 
|-
|{{Icon|Edit|4|60}}Edit
+
|{{Icon|Edit|4|60}}This is the Edit icon align 4 (mid-left) and size of 60pixels. It's also the default icon, and that who's choosen when names don't match. If you have an error, it will be this one displayed. A call with the string "General" will display this icon, since there's not General.png.
|{{Icon|Draw|5|75}}Draw
+
|{{Icon|Draw|5|75}}The Draw Icon displayed in 75 pixels. Should be in the center of the cell, cause "Position"=5
|{{Icon|Writer|6|90}}Writer
+
|{{Icon|Writer|6|90}}This icon for Writer is displayed in a comfortable 90 pixels size, but with a position of 6 should be aligned mid-right.
 +
|-
 +
|{{Icon|Calc|7|90}}90 pixels size also for this icon of Calc which should display at the bottom Left of the cell.
 +
|{{Icon|Setup|8|35}}A call with "Setup" in 35 pixels, aligned center-bottom
 +
|{{Icon|Wiki|9|50}}A fantaisist call to "Wiki", mapped to "Book" in an icon of 50 pixels, who should be displayed in the last position 9, thus bottom right of this cell...
 
|}
 
|}
  
Line 124: Line 131:
  
  
<noinclude>[[Category:Wiki Templates]]</noinclude>
+
<noinclude>[[Category:Wiki Templates]] [[Category:Icons]]</noinclude>

Latest revision as of 09:29, 1 June 2009

{{{3}}}px

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 
Mapping
Nine values from 1 to 9
From Top Left
To bottom Right
1 2 3
4 5 6
7 8 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 :
Nine values from 1 to 9
From Top Left
To bottom Right
1 2 3
4 5 6
7 8 9
Code :
{{Icon|Calc|3|40}}
Calc.png

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.png


Impress icon is called with {{Icon|Impress|1|120}} and this example need a lot of text to fill the cell, because of the icon size. Impress icon is called with {{Icon|Impress|1|120}} and this example need a lot of text to fill the cell, because of the icon size.

Math.png


The icon for Math, 60 pixels top-centered. Call {{Icon|Math|2|60}. The icon for Math, 60 pixels top-centered. Call {{Icon|Math|2|60}}.

Base.png


{{Icon|Base|3|80}} Give a floating icon for Base, 80 pixel sized, top right aligned. {{Icon|Base|3|80}} Give a floating icon for Base, 80 pixel sized, top right aligned. {{Icon|Base|3|80}} Give a floating icon for Base, 80 pixel sized, top right aligned.

Edit.png


This is the Edit icon align 4 (mid-left) and size of 60pixels. It's also the default icon, and that who's choosen when names don't match. If you have an error, it will be this one displayed. A call with the string "General" will display this icon, since there's not General.png.

Draw.png


The Draw Icon displayed in 75 pixels. Should be in the center of the cell, cause "Position"=5

Writer.png


This icon for Writer is displayed in a comfortable 90 pixels size, but with a position of 6 should be aligned mid-right.

Calc.png


90 pixels size also for this icon of Calc which should display at the bottom Left of the cell.

Edit.png


A call with "Setup" in 35 pixels, aligned center-bottom

Book.png


A fantaisist call to "Wiki", mapped to "Book" in an icon of 50 pixels, who should be displayed in the last position 9, thus bottom right of this cell...

Personal tools