Template:Service link/doc: Difference between revisions

From Against the Storm Official Wiki
(Moved documentation to subpage)
 
(Rewrote the documentation to follow the lead of other link templates.)
 
Line 1: Line 1:
'''NOTE: Documentation is outdated. Will update momentarily.'''
== Overview ==


Creates a link to a service's page.


The template validates that you have correctly spelled the service's name, and it automatically looks up and includes the icon for you. Any links returned by this template '''should''' have articles and not be redlinks.


'''Service link''' is a template that creates links to services on the wiki and includes an icon for improved recognition. Reuses standardizes icon size templates for consistency.
== Parameters ==


== Overview ==
=== Service ===


This template should be used liberally across the wiki, wherever the names of services are mentioned in paragraphs or in tables. The accompanying icons will help skimming for expert players and orientation for new players.
The name of the service is the only required parameter. Use it as it appears in-game; a missing or misspelled name will result in an error.


For in-paragraph display, which is presumed to be the most common utilization, the default icon size is <code>small</code>, or {{ImgS}} from [[Template:ImgS]]. For use in tables where more spacing between lines doesn't hurt readability or aesthetics, it is recommended to use <code>med</code>, which will increase the size of the icons to {{ImgM}} (from [[Template:ImgM]]).
If you do not wish to write the code <code>name=</code>, you may skip that, but you must specify the service before any other parameters.


Use your judgment when writing content. The first mention of a service in a paragraph should probably be done with this template. But you may find that paragraphs densely mentioning services become harder not easier to read. You may decide that after the first mention of the service , it's better for subsequent references to be in plain text or with this template but without an icon.
{|class=wikitable
 
! Parameter !! Type !! Description
== Usage ==
|-
| name || string || '''Required.''' The name of the service, as it appears in the game.
|}


<pre>
{{Service link|service|iconsize}}
</pre>


== Parameters ==
=== Output overrides ===


Only the first parameter, <code>service</code> is required, and it must be spelled correctly to match the in-game name of the service. The other parameter is optional but improve this template's applicability to more instances of its use. You may include or omit any parameters' names.
All of these parameters are optional and change how the link is formatted.


{|class="wikitable"
{|class=wikitable
|-
! Parameter !! Type !! Description
! Parameter !! Type !! Description
|-
|-
| service || string || '''Required.''' The in-game name of the service whose page you want to link to and whose icon you might want to display.
| size || string || The size of the icon to display. Choose one of the following:
* none
* small
* medium
* large
* huge (same as large for this template)
The default is <code>small</code>, suitable for paragraphs.
|-
|-
| iconsize || string || One of the following values to indicate the desired size of the icon:<br />
| display || string || If you include <code>display=notext</code> only the icon will be rendered.
<table><tr><td>
* <code>none</code>
* <code>small</code>
* <code>med</code>
* <code>large</code>
* <code>huge</code>
</td><td>
which will prevent an icon from displaying<br />
which sizes the icon to {{ImgS}} from [[Template:ImgS]], '''default'''<br />
which sizes the icon to {{ImgM}} from [[Template:ImgM]]<br />
which sizes the icon to {{ImgL}} from [[Template:ImgL]]<br />
which sizes the icon to {{ImgH}} from [[Template:ImgH]]
</td></tr></table>
|}
|}


== Errors ==
Specialization links that are written into paragraphs should use the small icon, which is the default.
 
When the template is called without a service name, the template reminds you that it is required.


'''Example:'''
== Examples ==


<pre>
=== Basic usage ===
{{Service link}}
</pre>


Yields:
<pre>{{Service link|Education}}</pre>
Makes a simple link to the {{Service link|Education}} article with a small icon for use in-paragraphs like this one. Please do not use icons larger than this in paragraphs or it will push the lines further apart, decreasing readability.


'''{{Service link}}'''


When providing the name of a service, it is important that it is spelled correctly, including any punctuation or spaces. Otherwise, you will see an error message:
<pre>{{Service link|Education|size=medium}}</pre>
Yields a moderately sized icon, suitable for use in lists and tables:


'''Example:'''
{{Service link|Education|size=medium}}


Broken: <code><nowiki>{{Service link|Educatoin}}</nowiki></code>


'''{{Service link|Educatoin}}'''
<pre>{{Service link|Education|size=large}}</pre>
Yields a larger icon for good recognition for use in tables with space that allows it:


Fixed: <code><nowiki>{{Service link|Education}}</nowiki></code>
{{Service link|Education|size=large}}


{{Service link|Education}}


== Additional Examples and Errors ==
<pre>{{Service link|Education|size=huge}}</pre>


Here are ways to call the template and the expected result:
Yields a very large icon, suitable for headlining tables and sections that feature this service:
 
{| class="wikitable"
! Parameters !! Examples !! Expected outcome
|-
| None
| <code><nowiki>{{Service link}}</nowiki></code>
| An error.
|-
| service only
| <code><nowiki>{{Service link|Luxury}}</nowiki></code>
|rowspan="2"| A small, text-sized icon and link, best for within paragraphs.
|-
|rowspan="4"| service and iconsize
| <code><nowiki>{{Service link|Leisure|small}}</nowiki></code>
|-
| <code><nowiki>{{Service link|Treatment|med}}</nowiki></code>
| A moderately-sized icon and a link, best in dense tables.
|-
| <code><nowiki>{{Service link|Brawling|large}}</nowiki></code>
| A large icon and a link, best as featured items within tables.
|-
| <code><nowiki>{{Service link|Religion|huge}}</nowiki></code>
| A very large icon and a link, in case you every need one this big.
|}


The following are generated by calling the template.
{{Service link|Education|size=huge}}


1 <code><nowiki>{{Service link|Education|none}}</nowiki></code> yields:


{{Service link|Education|none}}
=== Other examples ===


2. <code><nowiki>{{Service link|Education|small}}</nowiki></code> yields:
<pre>{{Service link|Religion|none}}</pre>
Yields only the label {{Service link|Religion|none}}, without an icon. This is a great alternative after using the regular link with the small icon in a paragraph, to avoid overwhelming the reader with icons.


{{Service link|Education|small}}


3. <code><nowiki>{{Service link|Education|med}}</nowiki></code> yields:
<pre>{{Service link|Religion|large|display=notext}}</pre>
Yields only the icon, for situations where the meanings are clear but space is limited:


{{Service link|Education|med}}
{{Service link|Religion|large|display=notext}}


4. <code><nowiki>{{Service link|Education|large}}</nowiki></code> yields:


{{Service link|Education|large}}
<pre>{{Service link|Religion|size=gigantic}}</pre>
Specifying an icon size that is not recognized does not return an error. Instead, it defaults to the small icon like this: {{Service link|Religion|size=gigantic}}


5. <code><nowiki>{{Service link|Education|huge}}</nowiki></code> yields:


{{Service link|Education|huge}}
=== Errors ===


The following are additional incorrect usages of the template:
The following are error messages generated by calling the template incorrectly.


6. With no service but an icon size, <code><nowiki>{{Service link||large}}</nowiki></code> yields:
<pre>{{Service link}}</pre>
With no arguments: {{Service link}}


'''{{Service link||large}}'''


Finally, providing an icon size that is not recognized does not break the template. There is a default icon size instead of returning an error.
<pre>{{Service link|name=Healthcare}}</pre>
Naming a specialization that doesn't exist in the game: {{Service link|name=Healthcare}}


9. With a valid service but invalid icon size, <code><nowiki>{{Service link|Education|gigantic}}</nowiki></code> yields:


{{Service link|Education|gigantic}}
<pre>{{Service link|large|Religion}}</pre>
Swapping the order of the parameters so that the service is not first: {{Service link|large|Religion}}

Latest revision as of 20:44, 9 November 2024

Overview

Creates a link to a service's page.

The template validates that you have correctly spelled the service's name, and it automatically looks up and includes the icon for you. Any links returned by this template should have articles and not be redlinks.

Parameters

Service

The name of the service is the only required parameter. Use it as it appears in-game; a missing or misspelled name will result in an error.

If you do not wish to write the code name=, you may skip that, but you must specify the service before any other parameters.

Parameter Type Description
name string Required. The name of the service, as it appears in the game.


Output overrides

All of these parameters are optional and change how the link is formatted.

Parameter Type Description
size string The size of the icon to display. Choose one of the following:
  • none
  • small
  • medium
  • large
  • huge (same as large for this template)

The default is small, suitable for paragraphs.

display string If you include display=notext only the icon will be rendered.

Specialization links that are written into paragraphs should use the small icon, which is the default.

Examples

Basic usage

{{Service link|Education}}

Makes a simple link to the Education Education article with a small icon for use in-paragraphs like this one. Please do not use icons larger than this in paragraphs or it will push the lines further apart, decreasing readability.


{{Service link|Education|size=medium}}

Yields a moderately sized icon, suitable for use in lists and tables:

Education Education


{{Service link|Education|size=large}}

Yields a larger icon for good recognition for use in tables with space that allows it:

Education Education


{{Service link|Education|size=huge}}

Yields a very large icon, suitable for headlining tables and sections that feature this service:

Education Education


Other examples

{{Service link|Religion|none}}

Yields only the label Religion, without an icon. This is a great alternative after using the regular link with the small icon in a paragraph, to avoid overwhelming the reader with icons.


{{Service link|Religion|large|display=notext}}

Yields only the icon, for situations where the meanings are clear but space is limited:

Religion


{{Service link|Religion|size=gigantic}}

Specifying an icon size that is not recognized does not return an error. Instead, it defaults to the small icon like this: Religion Religion


Errors

The following are error messages generated by calling the template incorrectly.

{{Service link}}

With no arguments: Lua error in Module:ServiceLink at line 72: The service you specified was not found. Please see the template documentation for how to use the parameters.


{{Service link|name=Healthcare}}

Naming a specialization that doesn't exist in the game: Lua error in Module:ServiceLink at line 48: The service you specified was not found. Please see the template documentation for how to use the parameters.


{{Service link|large|Religion}}

Swapping the order of the parameters so that the service is not first: Lua error in Module:ServiceLink at line 48: The service you specified was not found. Please see the template documentation for how to use the parameters.