Difference between revisions of "Template:Glossary"

From PCGamingWiki, the wiki about fixing PC games
m (adding support for 'name abbr' to basically specify a custom abbr name instead of lowercase (only used for e.g. ARPG, JRPG, and other like that))
m (corrected syntax)
Line 1: Line 1:
 
<includeonly><!--
 
<includeonly><!--
-->{{#ifeq: {{{display|}}} | abbr              | [[:{{{link|{{{name|}}}}}}|<abbr title="{{#arraymap: {{{definition|}}} | " | x | x | &quot; }}">{{{name abbr|{{lc:{{{name|}}}}}</abbr>]]}}} }}<!--
+
-->{{#ifeq: {{{display|}}} | abbr              | [[:{{{link|{{{name|}}}}}}|<abbr title="{{#arraymap: {{{definition|}}} | " | x | x | &quot; }}">{{{name abbr|{{lc:{{{name|}}}}}}}}</abbr>]] }}<!--
 
-->{{#ifeq: {{{display|}}} | uc                | [[:{{{link|{{{name|}}}}}}|<abbr title="{{#arraymap: {{{definition|}}} | " | x | x | &quot; }}">{{{name|}}}</abbr>]] }}<!--
 
-->{{#ifeq: {{{display|}}} | uc                | [[:{{{link|{{{name|}}}}}}|<abbr title="{{#arraymap: {{{definition|}}} | " | x | x | &quot; }}">{{{name|}}}</abbr>]] }}<!--
 
-->{{#ifeq: {{{display|}}} | image            | {{{image|}}}                                                                    }}<!--
 
-->{{#ifeq: {{{display|}}} | image            | {{{image|}}}                                                                    }}<!--

Revision as of 19:37, 10 July 2020

Documentation for the above template (sometimes hidden from view).

Description

{{Glossary}} is a multi-purpose template used beneath glossary pages to power easily accessible display modes through a simple interface as well as manage populated data in the same way across multiple usages.


Overview

  1. {{Glossary}} (this template) provides and supports a few standardized parameters for glossary pages to populate data through a standardized interface, as well as defines a few different display modes to display said data in an appropriate format.
  2. Glossary:TERM page transcludes and populates the {{Glossary}} template with appropriate data.
    • Along with this they also use |display = {{{1|abbr}}} to set the display parameter to the first parameter used when transcluding the glossary page itself, or default to abbr if unset.
    • This allows for efficient transclusion of the relevant data through the glossary page itself. For example {{Glossary:Ultra-widescreen}} can be used to retrieve the default abbreviation link (ultra-widescreen), or {{Glossary:Ultra-widescreen|definition}} can be used to retrieve the definition (Ultra-widescreen is a term that refers to widescreen resolutions with an aspect ratio roughly wider than 2:1, and often marketed as "21:9".)
  3. Editors then use {{Glossary:TERM}} or {{Glossary:TERM|display mode}} on other pages to easily transclude the appropriate data as desired.


Glossary page parameters

Multiple parameters are supported, but almost all are optional; their use is determined by the glossary page itself. The only "user-facing" parameter that is exposed to editors through other pages than the glossary pages themselves is the display parameter which determines what display mode is being used.

  • display - The requested display mode. This should always be set to |display = {{{1|abbr}}} on glossary pages. This is to enable handing down the display parameter from the original page (whatever it might be), down through the associated glossary page and to this actual template.
  • name - The term itself. This is used for titles where appropriate as well as the target page used in abbreviated links and the like.
  • name abbr - This is an override parameter that takes precedence over the name parameter when the abbr display mode is used. This basically allows to circumvent the otherwise enforced lowercase nature of that display mode ({{Glossary:FPS}} would appear as 'fps', but with this new parameter added it appears as 'FPS' instead).
  • link - The target of the abbr display mode. Helpful if the intention is to link to another page than TERM. Used for taxonomy pages to link to Category:TERM instead.
  • image - The file name of the image (under the File:XXXXX namespace) to use where appropriate.
  • image alt - The alt title of the image, shown while hovering with the mouse over it or when using a screen reader.
  • article - The page name of the article associated with the term. This is closely related to the glossary parameter.
  • category - The name of the category associated with the term.
  • glossary - The name of the glossary page that resides beneath the Glossary:XXXXX namespace. This is closely related to the article parameter.
  • list - The name of the list associated with the term.
  • cargo - Currently unused. Might be used in the future to document what Cargo table is associated with the term.
  • taxonomy - The taxonomy related category associated with the term.
  • definition - A short definition of the term and what it means.
  • examples - A few examples showcasing how the term relates to games.
  • notes - More in-depth notes regarding the term.


Supported transclusion parameters

When transcluding a glossary page, only a single parameter is supported -- that being the display mode to use.


Supported display modes

  • abbr (default) - Outputs an abbreviated link in lowercase to the associated page (set through the link parameter on the glossary page; defaults to name if not set).
    • To circumvent the otherwise enforced lowercase nature of abbr, there are two options available:
      • To enforce an override for all links using abbr (basically all links that looks like {{Glossary:FPS}}), add the name abbr parameter to the glossary page instead (see e.g. {{Glossary:FPS}} for an example).
      • For one-time link overrides, use the uc parameter (e.g. {{Glossary:Sci-fi|uc}}), which outputs the abbreviated link in non-lowercase (so typically normal case, with the first letter being uppercase).
  • link - Outputs the associated link itself without any styling applied (set through the link parameter on the glossary page).
  • uc - Outputs the abbreviated link in non-lowercase (so typically normal case, with the first letter being uppercase).
  • image - Outputs the image associated with the term (set through the image parameter on the glossary page).
  • article - Outputs a link to the article page associated with the term (set through the article parameter on the glossary page).
  • list - Outputs a link to the list page associated with the term (set through the list parameter on the glossary page).
  • cargo - Outputs a link to the cargo table associated with the term (set through the cargo parameter on the glossary page).
  • category - Outputs a link to the category associated with the term (set through the category parameter on the glossary page).
  • taxonomy - Outputs a link to the taxonomy category associated with the term (set through the taxonomy parameter on the glossary page).
  • definition - Outputs the definition associated with the term (set through the definition parameter on the glossary page).
  • examples - Outputs the examples associated with the term (set through the examples parameter on the glossary page).
  • notes - Outputs the notes associated with the term (set through the notes parameter on the glossary page).
  • box - Outputs a customized infobox based on data provided to the template through the various other parameters.


Examples

  • See {{Glossary:Ultra-widescreen}} for a basic example that implements {{Glossary}} for regular use.
  • For a more advanced example, see how Taxonomy makes use of the {{Taxonomy/table/row}} template to populate multiple table cells with the desired available data from each retrieved glossary type. Instead of retrieving the data through different templates for each type of data that would need to be separately updated it instead makes calls to the same repository of data, that being the glossary page itself.


In-depth example #1

Typing this:
{{Glossary:Ultra-widescreen|definition}}
Will appear on the page like this: Ultra-widescreen is a term that refers to widescreen resolutions with an aspect ratio roughly wider than 2:1, and often marketed as "21:9".


In-depth example #2

Typing this:
{{Glossary:Ultra-widescreen|image}}
Will appear on the page like this: UWcomparison.png


In-depth example #3

Typing this:
{{Glossary:Ad-supported|examples}}
Will appear on the page like this:
  • NBA 2K20 video advertisements before playing a match.


In-depth example #4

Typing this:
{{Glossary:Ad-supported|category}}
Will appear on the page like this: Ad-supported


In-depth example #5

The box display mode is the most comprehensive one yet, and used to populate a lot of information about the term through an infobox.

Typing this:
{{Glossary:Ad-supported|box}}
Will appear on the page like this:
Ad-supported
Definition
Examples
Notes
Monetization
Ad-supported
DLC
Expansion pack
Free-to-play
Freeware
Sponsored
Subscription