Module:SpeciesLink: Difference between revisions
From Against the Storm Official Wiki
No edit summary |
No edit summary |
||
| Line 19: | Line 19: | ||
-- the data is being updated), then a question-mark icon will take the place of | -- the data is being updated), then a question-mark icon will take the place of | ||
-- the Species's icon. This is so that people using this template will not | -- the Species's icon. This is so that people using this template will not | ||
-- mistake a missing icon for an issue with this template and can | -- mistake a missing icon for an issue with this template and can efficienty | ||
-- troubleshoot. | -- troubleshoot. | ||
-- | -- | ||
| Line 33: | Line 33: | ||
["Foxes"] = { | ["Foxes"] = { | ||
["pagename"] = "Foxes", | ["pagename"] = "Foxes", | ||
["icon"] = " | ["icon"] = "fox_circle.png" | ||
}, | }, | ||
["Harpies"] = { | ["Harpies"] = { | ||
["pagename"] = "Harpies", | ["pagename"] = "Harpies", | ||
["icon"] = " | ["icon"] = "harpy_circle.png" | ||
}, | }, | ||
["Humans"] = { | ["Humans"] = { | ||
["pagename"] = "Humans", | ["pagename"] = "Humans", | ||
["icon"] = " | ["icon"] = "human_circle.png" | ||
}, | }, | ||
["Beavers"] = { | ["Beavers"] = { | ||
["pagename"] = "Beavers", | ["pagename"] = "Beavers", | ||
["icon"] = " | ["icon"] = "beaver_circle.png" | ||
}, | }, | ||
["Lizards"] = { | ["Lizards"] = { | ||
["pagename"] = "Lizards", | ["pagename"] = "Lizards", | ||
["icon"] = " | ["icon"] = "lizard_circle.png" | ||
} | } | ||
} | } | ||
| Line 65: | Line 65: | ||
local S_SML = "small" | local S_SML = "small" | ||
local S_MED = "med" | local S_MED = "med" | ||
local | local S_L | ||
Revision as of 15:37, 11 November 2023
Documentation for this module may be created at Module:SpeciesLink/doc
-- This module renders the {{Species _link}} template.
-- https://hoodedhorse.com/wiki/Against_the_Storm/Template:Species_link
--
-- This template #invokes SpeciesLink.renderLink(frame), below.
--
-- The template requires an argument, the name of the Species to which to link.
-- Optionally, the template accepts a second argument to change the size of the
-- icon that accompanies the text hyperlink. The Species is passed to
-- Module:SpeciesData, which is used to identify the wiki page to link to. It
-- also handles some basic normalization to tolerate small mistakes in spelling,
-- spacing, or punctuation.
--
-- Using the data returned, this module creates an icon and the name of the
-- Species, and wraps both in a link to the Species's wiki page. If no icon
-- size is specified, the icon will default to a size appropriate for display
-- in-line with other text.
--
-- IF there is a known Species that does not have an icon (might be the case if
-- the data is being updated), then a question-mark icon will take the place of
-- the Species's icon. This is so that people using this template will not
-- mistake a missing icon for an issue with this template and can efficienty
-- troubleshoot.
--
-- The icons are sized consistently by using existing wiki templates, {{ImgS}},
-- {{ImgM}}, etc. The sizes of icons are not stored or known by this module.
-- @module SpeciesLink
local SpeciesLink = {}
--
-- Dependencies
--
local SpeciesData = {
["Foxes"] = {
["pagename"] = "Foxes",
["icon"] = "fox_circle.png"
},
["Harpies"] = {
["pagename"] = "Harpies",
["icon"] = "harpy_circle.png"
},
["Humans"] = {
["pagename"] = "Humans",
["icon"] = "human_circle.png"
},
["Beavers"] = {
["pagename"] = "Beavers",
["icon"] = "beaver_circle.png"
},
["Lizards"] = {
["pagename"] = "Lizards",
["icon"] = "lizard_circle.png"
}
}
--
-- Constants
--
-- names of the templates used to size the icons consistently
local TEMPLATE_IMGSMALL = "ImgS"
local TEMPLATE_IMGMED = "ImgM"
local TEMPLATE_IMGLARGE = "ImgL"
local TEMPLATE_IMGHUGE = "ImgH"
-- string options for icon size arguments
local S_SML = "small"
local S_MED = "med"
local S_L


