Module:Inline singer lyrics/data
This module is loaded by Module:Inline singer lyrics and Module:Inline singer lyrics/Singer list. This module contains the following sub-tables and entries:
lang
– the language tag for HTMLlang
attribute. This value is to allow porting the module to another wiki.parens
– hidden parentheses and separator characters that would be generated in the singer list by Module:Inline singer lyrics. This value is also for porting to another wiki.map
– a map of all valid singer keywords to their corresponding icons, colors and character names (as alt texts).allSingers
– an ordered list of singer keywords, used by Module:Inline singer lyrics/Singer list only.
The helper functions, tryConvertColor
and getTextColor
, are for internal use for this module. They help retrieve and compute color values for some table fields. Since this module is intended to loaded by mw.loadData
, the table values will be computed once per page load and they shouldn't take too much time in terms of performance.
A singer (character) entry within the map
contains the following fields:
icon
– The icon representing the character. A file name (without the "File:" namespace prefix) must be specified.textcolor
– The color representing the character. This must be a value that can be used in CSScolor
property.[note 1] A hexadecimal notation (such as#c0c0c0
) is preferred.alt
– The name of the singer (character) that serves as an alternative text. The English name of the character should be used, as the "inline singer lyrics" module does not support localizations and it produceslang="en"
HTML attributes for singer names.[note 2]
The reason for the allSingers
list is that Lua tables (associative arrays) do not store the order of which the entry is added into the table. In order to present the map entries in a logical order (by game and then by the "natural"/news/Splatfest presentation order of the characters), an explicit ordered list is used.
To add a new singer entry for use in "Inline singer lyrics" template, just edit the map
and allSingers
sub-tables. Look for the comments to see where to insert the new entry.[note 3] The "Supported singer keywords" in this documentation page will reflect with the new change automatically. (If not, purge the cache to see it.)
Dependency:
Notes:
- ↑ Contrary to the field name, this value is currently used in
background-color
property and not as the text color. - ↑ The language tag may change as the "inline singer lyrics" modules are localized to other wikis.
- ↑ A Lua comment starts with
--
(two hyphens), unquoted, and continues until the end of the line. The Lua language supports multi-line comments but they are not needed for the purpose of this module.
Singer keyword | Mapped data | ||
---|---|---|---|
Icon | Color | Alt text | |
S Callie
|
S_Icon_Callie.png ![]() |
#c502e3 | Callie |
S Marie
|
S_Icon_Marie.png ![]() |
#358500 | Marie |
S2 Callie
|
S2_Icon_Callie.png ![]() |
#cd00db | Callie |
S2 Marie
|
S2_Icon_Marie_2.png ![]() |
#038745 | Marie |
S2 Pearl
|
S2_Icon_Pearl.png ![]() |
#e00083 | Pearl |
S2 Marina
|
S2_Icon_Marina.png ![]() |
#06844f | Marina |
OE Pearl
|
OE_Icon_Pearl_relationship_chart.png ![]() |
#e00083 | Pearl |
OE Marina
|
OE_Icon_Marina_relationship_chart.png ![]() |
#06844f | Marina |
S3 Callie
|
RotM_Icon_Agent_1.png ![]() |
#a000c8 | Callie |
S3 Marie
|
RotM_Icon_Agent_2.png ![]() |
#7fd39c | Marie |
S3 Pearl
|
S3_Icon_Pearl.png ![]() |
#e00083 | Pearl |
S3 Marina
|
S3_Icon_Marina.png ![]() |
#06844f | Marina |
S3 Shiver
|
RotM_Icon_Shiver.png ![]() |
#1437ff | Shiver |
S3 Frye
|
RotM_Icon_Frye.png ![]() |
#e5de00 | Frye |
S3 Big Man
|
RotM_Icon_Big_Man.png ![]() |
#9c9c9c | Big Man |
S3 Ian BGM
|
RotM_Icon_Big_Man.png ![]() |
#9c9c9c | Ian BGM |
SO Pearl
|
SO_Icon_Pearl.png ![]() |
#e00083 | Pearl |
SO Marina
|
SO_Icon_Marina.png ![]() |
#06844f | Marina |
Any other value | RotM_Icon_???_square.png ![]() |
#000000 | keyword |
Note: The actual list of singers is defined in Module:Inline singer lyrics/data. The code for generating this table is located in Module:Inline singer lyrics/Singer list. |
--[[ This module is intended to be loaded with mw.loadData(). -- It contains no functions that can be called by {{#invoke:}}. ]] local _getTextColor = require('Module:Text color').getColor local tryConvertColor = function (s) local r, g, b -- [[Module:Text_color]] currently outputs color values in triples -- of decimal integers. r, g, b = string.match(s, '^%s*(%d*)%s*,%s*(%d*)%s*,%s*(%d*)') if b ~= nil then r = tonumber(r, 10) if r > 255 then r = 255 end g = tonumber(g, 10) if g > 255 then g = 255 end b = tonumber(b, 10) if b > 255 then b = 255 end return string.format("#%06x", r * 65536 + g * 256 + b) end return s end local getTextColor = function (colorKey) return tryConvertColor(_getTextColor(colorKey)) end local t = { ['lang'] = 'en', ['parens'] = { ['en'] = {'(', ':) ', '/'}, }, ['map'] = { [''] = { -- Any unrecognized singer keyword resolves to this. ['icon'] = 'RotM_Icon_???_square.png', ['textcolor'] = '#000000', ['alt'] = '', }, ['S Callie'] = { ['icon'] = 'S_Icon_Callie.png', ['textcolor'] = getTextColor('Callie'), ['alt'] = 'Callie', }, ['S Marie'] = { ['icon'] = 'S_Icon_Marie.png', ['textcolor'] = getTextColor('Marie'), ['alt'] = 'Marie', }, ['S2 Callie'] = { ['icon'] = 'S2_Icon_Callie.png', ['textcolor'] = getTextColor('Callie S2'), ['alt'] = 'Callie', }, ['S2 Marie'] = { ['icon'] = 'S2_Icon_Marie_2.png', ['textcolor'] = getTextColor('Marie S2'), ['alt'] = 'Marie', }, ['S2 Pearl'] = { ['icon'] = 'S2_Icon_Pearl.png', ['textcolor'] = getTextColor('Pearl'), ['alt'] = 'Pearl', }, ['S2 Marina'] = { ['icon'] = 'S2_Icon_Marina.png', ['textcolor'] = getTextColor('Marina'), ['alt'] = 'Marina', }, ['OE Pearl'] = { ['icon'] = 'OE_Icon_Pearl_relationship_chart.png', ['textcolor'] = getTextColor('Pearl'), ['alt'] = 'Pearl', }, ['OE Marina'] = { ['icon'] = 'OE_Icon_Marina_relationship_chart.png', ['textcolor'] = getTextColor('Marina'), ['alt'] = 'Marina', }, ['S3 Callie'] = { ['icon'] = 'RotM_Icon_Agent_1.png', ['textcolor'] = getTextColor('Callie RotM'), ['alt'] = 'Callie', }, ['S3 Marie'] = { ['icon'] = 'RotM_Icon_Agent_2.png', ['textcolor'] = getTextColor('Marie RotM'), ['alt'] = 'Marie', }, ['S3 Pearl'] = { ['icon'] = 'S3_Icon_Pearl.png', ['textcolor'] = getTextColor('Pearl'), ['alt'] = 'Pearl', }, ['S3 Marina'] = { ['icon'] = 'S3_Icon_Marina.png', ['textcolor'] = getTextColor('Marina'), ['alt'] = 'Marina', }, ['S3 Shiver'] = { ['icon'] = 'RotM_Icon_Shiver.png', ['textcolor'] = getTextColor('Shiver'), ['alt'] = 'Shiver', }, ['S3 Frye'] = { ['icon'] = 'RotM_Icon_Frye.png', ['textcolor'] = getTextColor('Frye RotM'), ['alt'] = 'Frye', }, ['S3 Big Man'] = { ['icon'] = 'RotM_Icon_Big_Man.png', ['textcolor'] = getTextColor('Big Man'), ['alt'] = 'Big Man', }, ['S3 Ian BGM'] = { ['icon'] = 'RotM_Icon_Big_Man.png', ['textcolor'] = getTextColor('Big Man'), ['alt'] = 'Ian BGM', }, ['SO Pearl'] = { ['icon'] = 'SO_Icon_Pearl.png', ['textcolor'] = getTextColor('Pearl'), ['alt'] = 'Pearl', }, ['SO Marina'] = { ['icon'] = 'SO_Icon_Marina.png', ['textcolor'] = getTextColor('Marina'), ['alt'] = 'Marina', }, -- Add new singer keyword before this line }, ['allSingers'] = { 'S Callie', 'S Marie', 'S2 Callie', 'S2 Marie', 'S2 Pearl', 'S2 Marina', 'OE Pearl', 'OE Marina', 'S3 Callie', 'S3 Marie', 'S3 Pearl', 'S3 Marina', 'S3 Shiver', 'S3 Frye', 'S3 Big Man', 'S3 Ian BGM', 'SO Pearl', 'SO Marina', -- Add new singer keyword before this line }, } return t