Template:Portal/doc: Difference between revisions

From Zoophilia Wiki
Jump to navigationJump to search
meta>Eubulides
Describe proposed title= parameter, along with link= and alt= proposed behavior.
meta>Eubulides
List all the parameters methodically, and describe a simpler interpretation for the title-text parameter.
Line 4: Line 4:
This template is used to produce a link in a box to a [[Portal:List of portals|portal]].
This template is used to produce a link in a box to a [[Portal:List of portals|portal]].


===Optional parameters===
===Parameters===
<nowiki>{{</nowiki>'''portal'''|name|image|size|boxsize|break=yes|left=yes|margin=|alt=''Alt text''|link=''Link''}}
: <code>'''<nowiki>{{</nowiki>portal|<var>Name</var>|<var>Image</var> |size=<var>Size</var> |boxsize=<var>Boxsize</var> |break=yes |left=yes |margin=<var>Margin</var> |link=<var>Target</var> |alt=<var>Alt&nbsp;text</var> |title=<var>Title&nbsp;text</var> }}'''</code>
The units assumed for <code>size</code> (the width of the image) and <code>boxsize</code> (the width of the box containing the image and portal link) are pixels (px). By default, the box is surrounded by a margin of width 0.5em, but this can be customized using <code>margin=''top'' ''right'' ''bottom'' ''left''</code> (e.g. <code style="font-size:95%;">margin=0.25em 0 0.25em 0.25em</code>) or removed using <code>margin=0</code> (zero).


By default the image is assumed to be purely decorative in the [[WP:ALT #Purely decorative images|W3C sense]] that it conveys no significant information other than what is in the adjacent text and nothing should happen when you click on it. No alt text is generated for the image, and the image does not link to anything. The image's [[HTML#Attributes|title attribute]] contains a URL to the file page, to satisfy any licensing concerns; this URL is put into the title attribute, rather than in the usual way as a link from the image, to avoid [[WP:ACCESSIBILITY|accessibility]] problems by visually impaired readers. This behavior can be overridden with the {{para|alt}}, {{para|link}}, and {{para|title}} parameters as described below.
The following parameters are available. They are all optional.


* {{para|alt|<var>Text</var>}} specifies the alt text for the image, for visually impaired readers. The default is empty. If {{para|link|File:}} is specified, the alt text should describe the image's visual appearance; if some other nonempty link target is specified, the alt text should describe the function of the image, not its visual appearance. For more, please see ''[[Wikipedia:Alternative text for images]]''.
; <code><var>Name</var></code> : The name of the portal. This defaults to the current page's name.
* {{para|link|<var>Target</var>}} specifies the link target for the image. The default is empty, which means the image does not link to anything. A target of <code>File:</code> means that the image links to its file page. The target can be the name of a Wikipedia page, and it can be a URL. Normally the target should not also be a target of the adjacent text, as that would be [[WP:OVERLINKING|overlinking]]. If a nonempty link is specified, nonempty {{para|alt}} should also be specified.
 
* {{para|title|<var>Text</var>}} specifies the title text for the image, which is typically displayed as [[tooltip]] with graphical browsers. It defaults to empty, except that to support historical usage if an image is specified and neither {{para|alt}} nor {{para|link}} are specified, it defaults to the URL of the file page for the image as described above. To suppress this historical usage, specify {{{link|}}} or {{{title|}}} with empty operands.
; <code><var>Image</var></code> : The image to use for the portal's icon. This defaults to a generic image.
 
; {{para|size|<var>Size</var>}} : The width of the icon, as an integer. This is in units of pixels. The default is 32. The icon is also constrained to be at most 28 pixels high.
 
; {{para|boxsize|<var>Boxsize</var>}} : The width of the box, as an integer. This is in units of pixels. The default is to use a box wide enough to hold the text, if possible.
 
; {{para|break|yes}} : In the text, put a line break between the portal's name and the word "portal".
 
; {{para|left|yes}} : Float the box to the left instead of to the right.
 
; {{para|margin|<var>Margin</var>}} : The margin around the box. By default, the box is surrounded by a margin of width 0.5em, but this can be customized using {{para|margin|<var>top right bottom left</var>}} (''e.g.'', {{para|margin|0.25em 0 0.25em 0.25em}}) or removed using {{para|margin|0}} (zero).
 
; {{para|link|<var>Target</var>}} : the link target for the image. The default is empty, which means the image does not link to anything. A target of <code>File:</code> means that the image links to its file page. The target can be the name of a Wikipedia page, and it can be a URL. Normally the target should not also be a target of the adjacent text, as that would be [[WP:OVERLINKING|overlinking]]. If a nonempty link is specified, nonempty {{para|alt}} should also be specified.
 
; {{para|alt|<var>Alt&nbsp;text</var>}} : The alt text for the image, for visually impaired readers.  The default is empty. If {{para|link|File:}} is specified, the alt text should describe the image's visual appearance; if some other nonempty link target is specified, the alt text should describe the function of the image, not its visual appearance. For more, please see ''[[Wikipedia:Alternative text for images]]''.
 
; {{para|title|<var>Title&nbsp;text</var>}} : The title text for the image, which is typically displayed as [[tooltip]] with graphical browsers. It defaults to the URL of the file page for the image, to satisfy any licensing requirements; this URL is by default placed here, rather than in the usual way as a link from the image, to avoid [[WP:ACCESSIBILITY|accessibility]] problems by visually impaired readers. If an image's license requires attribution (see ''[[Wikipedia:Alternative text for images#Purely decorative images|guideline]]''), and if {{para|title}} is used with a parameter that does not contain the file page's URL, then {{para|link|File:}} and {{para|alt|<var>Alt&nbsp;text</var>}} should also be specified.


===Location===
===Location===
Within articles, this template is meant to be placed at the bottom of the article in the "See also" section.
Within articles, this template is meant to be placed at the bottom of the article in the ''See also''" section.


===Examples===
===Examples===
{| style="background:transparent;"
{| style="background:transparent;"
|- style="font-size:120%;"  
|- style="font-size:120%;"
! Code<hr/> !! Result<hr/>
! Code<hr/> !! Result<hr/>
|-
|-
Line 28: Line 43:
| {{portal|Science}}
| {{portal|Science}}
|-
|-
| <small><pre>{{portal|Spaceflight|RocketSunIcon.svg|link=}}</pre></small>
| <small><pre>{{portal|Spaceflight|RocketSunIcon.svg}}</pre></small>
| {{portal|Spaceflight|RocketSunIcon.svg|link=}}
| {{portal|Spaceflight|RocketSunIcon.svg}}
|-
|-
| <small><pre>{{portal|Spaceflight|RocketSunIcon.svg|link=Special:Search
| <small><pre>{{portal|Spaceflight|RocketSunIcon.svg |title= }}</pre></small>
|alt=Search spaceflight portal
| {{portal|Spaceflight|RocketSunIcon.svg |title= }}
}}</pre></small>
| {{portal|Spaceflight|RocketSunIcon.svg|link=Special:Search
|alt=Search spaceflight portal
}}
|-
|-
| <small><pre>{{portal|Spaceflight|RocketSunIcon.svg|link=Special:Search
| <small><pre>{{portal|Spaceflight|RocketSunIcon.svg |link=Special:Search
|alt=Search spaceflight portal
|alt=Search spaceflight portal
|title=Explore space!
|title=Explore space!
}}</pre></small>
}}</pre></small>
| {{portal|Spaceflight|RocketSunIcon.svg|link=Special:Search
| {{portal|Spaceflight|RocketSunIcon.svg |link=Special:Search
|alt=Search spaceflight portal
|alt=Search spaceflight portal
|title=Explore space!
|title=Explore space!
}}
}}
|-
|-

Revision as of 20:20, 9 November 2009

This template is used to produce a link in a box to a portal.

Parameters

{{portal|Name|Image |size=Size |boxsize=Boxsize |break=yes |left=yes |margin=Margin |link=Target |alt=Alt text |title=Title text }}

The following parameters are available. They are all optional.

Name
The name of the portal. This defaults to the current page's name.
Image
The image to use for the portal's icon. This defaults to a generic image.
|size=Size
The width of the icon, as an integer. This is in units of pixels. The default is 32. The icon is also constrained to be at most 28 pixels high.
|boxsize=Boxsize
The width of the box, as an integer. This is in units of pixels. The default is to use a box wide enough to hold the text, if possible.
|break=yes
In the text, put a line break between the portal's name and the word "portal".
|left=yes
Float the box to the left instead of to the right.
|margin=Margin
The margin around the box. By default, the box is surrounded by a margin of width 0.5em, but this can be customized using |margin=top right bottom left (e.g., |margin=0.25em 0 0.25em 0.25em) or removed using |margin=0 (zero).
|link=Target
the link target for the image. The default is empty, which means the image does not link to anything. A target of File: means that the image links to its file page. The target can be the name of a Wikipedia page, and it can be a URL. Normally the target should not also be a target of the adjacent text, as that would be overlinking. If a nonempty link is specified, nonempty |alt= should also be specified.
|alt=Alt text
The alt text for the image, for visually impaired readers. The default is empty. If |link=File: is specified, the alt text should describe the image's visual appearance; if some other nonempty link target is specified, the alt text should describe the function of the image, not its visual appearance. For more, please see Wikipedia:Alternative text for images.
|title=Title text
The title text for the image, which is typically displayed as tooltip with graphical browsers. It defaults to the URL of the file page for the image, to satisfy any licensing requirements; this URL is by default placed here, rather than in the usual way as a link from the image, to avoid accessibility problems by visually impaired readers. If an image's license requires attribution (see guideline), and if |title= is used with a parameter that does not contain the file page's URL, then |link=File: and |alt=Alt text should also be specified.

Location

Within articles, this template is meant to be placed at the bottom of the article in the See also" section.

Examples

Code
Result
{{portal}}
{{portal|Science}}
{{portal|Spaceflight|RocketSunIcon.svg}}
{{portal|Spaceflight|RocketSunIcon.svg |title= }}
{{portal|Spaceflight|RocketSunIcon.svg |link=Special:Search
 |alt=Search spaceflight portal
 |title=Explore space!
}}
{{portal|Science|size=15}}
{{portal|Science|boxsize=50}}
{{portal|Science|break=yes}}
{{portal|Science|break=yes|left=yes}}

See also