Template:Service link: Difference between revisions

From Against the Storm Official Wiki
(Created to make linking to pages on services easier)
 
m (renaming parameters; hope it doesn't break too much!)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>{{#invoke:ServiceLink|serviceLink|service={{{1|{{{service|}}} }}}|iconsize={{{2|{{{iconsize|}}} }}} }}</includeonly><noinclude>
<includeonly>{{#invoke:ServiceLink|main
|name={{{name|{{{1|}}}}}}
|size={{{size|{{{2|}}}}}}
|display={{{display|}}}
}}</includeonly><noinclude>


'''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.
{{Documentation}}


== Overview ==
[[Category:Link templates]]
 
[[Category:Lua-based modules]]</noinclude>
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.
 
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]]).
 
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.
 
== Usage ==
 
<pre>
{{Service link|service|iconsize}}
</pre>
 
== Parameters ==
 
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.
 
{|class="wikitable"
|-
! 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.
|-
| iconsize || string || One of the following values to indicate the desired size of the icon:<br />
<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 ==
 
When the template is called without a service name, the template reminds you that it is required.
 
'''Example:'''
 
<pre>
{{Service link}}
</pre>
 
Yields:
 
'''{{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:
 
'''Example:'''
 
Broken: <code><nowiki>{{Service link|Educatoin}}</nowiki></code>
 
'''{{Service link|Educatoin}}'''
 
Fixed: <code><nowiki>{{Service link|Education}}</nowiki></code>
 
{{Service link|Education}}
 
== Additional Examples and Errors ==
 
Here are ways to call the template and the expected result:
 
{| 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.
 
1 <code><nowiki>{{Service link|Education|none}}</nowiki></code> yields:
 
{{Service link|Education|none}}
 
2. <code><nowiki>{{Service link|Education|small}}</nowiki></code> yields:
 
{{Service link|Education|small}}
 
3. <code><nowiki>{{Service link|Education|med}}</nowiki></code> yields:
 
{{Service link|Education|med}}
 
4. <code><nowiki>{{Service link|Education|large}}</nowiki></code> yields:
 
{{Service link|Education|large}}
 
5. <code><nowiki>{{Service link|Education|huge}}</nowiki></code> yields:
 
{{Service link|Education|huge}}
 
The following are additional incorrect usages of the template:
 
6. With no service but an icon size, <code><nowiki>{{Service link||large}}</nowiki></code> yields:
 
'''{{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.
 
9. With a valid service but invalid icon size, <code><nowiki>{{Service link|Education|gigantic}}</nowiki></code> yields:
 
{{Service link|Education|gigantic}}</noinclude>

Latest revision as of 20:29, 9 November 2024


This is the Template Documentation from Template:Service link/doc.

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.