Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:TagCreatures: Difference between revisions

From Teriock
Content deleted Content added
// via Wikitext Extension for VSCode
 
// via Wikitext Extension for VSCode
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
-- Module:TagCreatures
local tags = {
-- Readonly via mw.loadData in consumers.
return {
traits = {
traits = {
undead = { text = 'Undead', link = 'Undead creatures', symbol = '🪦' },
undead = {
beast = { text = 'Beast', link = 'Beast creatures', symbol = '🦣' },
text = 'Undead',
link = 'Undead creatures',
corporeal = { text = 'Corporeal', link = 'Corporeal undead creatures', symbol = '🧟‍♀️' },
skeletal = { text = 'Skeletal', link = 'Skeletal undead creatures', symbol = '🦴' },
symbol = '🪦',
spectral = { text = 'Spectral', link = 'Spectral undead creatures', symbol = '👻' },
},
minor = { text = 'Minor', link = 'Minor undead creatures', symbol = '🧟' },
corporeal = {
full = { text = 'Full', link = 'Full undead creatures', symbol = '💀' },
text = 'Corporeal',
link = 'Corporeal undead creatures',
greater = { text = 'Greater', link = 'Greater undead creatures', symbol = '🧛' },
outsider = { text = 'Outsider', link = 'Outsider creatures', symbol = '👽️' },
symbol = '🧟‍♀️',
celestial = { text = 'Celestial', link = 'Celestial creatures', symbol = '😇' },
},
infernal = { text = 'Infernal', link = 'Infernal creatures', symbol = '👿' },
skeletal = {
elemental = { text = 'Elemental', link = 'Elemental creatures', symbol = '🌞' },
text = 'Skeletal',
link = 'Skeletal undead creatures',
plant = { text = 'Plant', link = 'Plant creatures', symbol = '🌿' },
construct = { text = 'Construct', link = 'Construct creatures', symbol = '🗿' },
symbol = '🦴',
draconic = { text = 'Draconic', link = 'Draconic creatures', symbol = '🐲' },
},
fae = { text = 'Fae', link = 'Fae creatures', symbol = '🧚' },
spectral = {
animal = { text = 'Animal', link = 'Animal creatures', symbol = '🦀' },
text = 'Spectral',
link = 'Spectral undead creatures',
common = { text = 'Common', link = 'Common animal creatures', symbol = '🐾' },
ooze = { text = 'Ooze', link = 'Ooze creatures', symbol = '💩' },
symbol = '👻',
monstrous = { text = 'Monstrous', link = 'Monstrous creatures', symbol = '🧌' },
},
humanoid = { text = 'Humanoid', link = 'Humanoid creatures', symbol = '👤' },
minor = {
pc = { text = 'Playable', link = 'Player character creatures', symbol = '🧍' },
text = 'Minor',
link = 'Minor undead creatures',
partial = { text = 'Partial', link = 'Partial humanoid creatures', symbol = '🐒' },
aquatic = { text = 'Aquatic', link = 'Aquatic creatures', symbol = '🐟️' },
symbol = '🧟',
-- angelic = { text = 'Angelic', link = 'Angelic creatures', symbol = '😇' },
},
-- demonic = { text = 'Demonic', link = 'Demonic creatures', symbol = '👿' },
full = {
text = 'Full',
link = 'Full undead creatures',
symbol = '💀',
},
greater = {
text = 'Greater',
link = 'Greater undead creatures',
symbol = '🧛',
},
outsider = {
text = 'Outsider',
link = 'Outsider creatures',
symbol = '👽️',
},
angelic = {
text = 'Angelic',
link = 'Angelic creatures',
symbol = '😇',
},
demonic = {
text = 'Demonic',
link = 'Demonic creatures',
symbol = '👿',
},
elemental = {
text = 'Elemental',
link = 'Elemental creatures',
symbol = '🌞',
},
plant = {
text = 'Plant',
link = 'Plant creatures',
symbol = '🌿'
},
construct = {
text = 'Construct',
link = 'Construct creatures',
symbol = '🗿'
},
draconic = {
text = 'Draconic',
link = 'Draconic creatures',
symbol = '🐲',
},
fae = {
text = 'Fae',
link = 'Fae creatures',
symbol = '🧚',
},
animal = {
text = 'Animal',
link = 'Animal creatures',
symbol = '🦀',
},
common = {
text = 'Common',
link = 'Common animal creatures',
symbol = '🐾',
},
ooze = {
text = 'Ooze',
link = 'Ooze creatures',
symbol = '💩',
},
monstrous = {
text = 'Monstrous',
link = 'Monstrous creatures',
symbol = '🧌',
},
humanoid = {
text = 'Humanoid',
link = 'Humanoid creatures',
symbol = '👤',
},
partial = {
text = 'Partial',
link = 'Partial humanoid creatures',
symbol = '🐒',
},
aquatic = {
text = 'Aquatic',
link = 'Aquatic creatures',
symbol = '🐟️',
},
}
}
}
}

local function makeTag(frame, key, value, makeCat, transparent)
if not tags[key] or not tags[key][value] then
if value then
local out = frame:preprocess("{{ucfirst:" .. tostring(value) .. "}}")
-- local out = 'pranked'
if not ('.' == out:sub(-1)) then
out = out .. '.'
end
return out
else
return ''
end
end
local tag = tags[key][value]
if tag.no then
local out = frame:preprocess("{{ucfirst:" .. tag.text .. "}}")
if not ('.' == out:sub(-1)) then
out = out .. '.'
end
return out
end
if tag.tags then
local out = ''
for _, t in ipairs(tag.tags) do
out = out .. makeTag(frame, key, t, makeCat, transparent)
end
return out
end
local tagText = "{{Tag|{{ucfirst:" .. tag.text .. "}}"
if tag.symbol then
tagText = tagText .. "|" .. tag.symbol
end
if tag.link then
tagText = tagText .. "|l=:Category:{{ucfirst:" .. tag.link .. "}}"
end
if tag.color then
tagText = tagText .. "|c=" .. tag.color
end
if transparent then
tagText = tagText .. "|o=1"
end
tagText = tagText .. "}}"
-- out = frame:preprocess(tagText)
out = tagText
return out
end

Latest revision as of 18:19, 18 August 2025

Documentation for this module may be created at Module:TagCreatures/doc

-- Module:TagCreatures
-- Readonly via mw.loadData in consumers.
return {
	traits = {
		undead    = { text = 'Undead',    link = 'Undead creatures',           symbol = '🪦' },
		beast     = { text = 'Beast',     link = 'Beast creatures',            symbol = '🦣' },
		corporeal = { text = 'Corporeal', link = 'Corporeal undead creatures', symbol = '🧟‍♀️' },
		skeletal  = { text = 'Skeletal',  link = 'Skeletal undead creatures',  symbol = '🦴' },
		spectral  = { text = 'Spectral',  link = 'Spectral undead creatures',  symbol = '👻' },
		minor     = { text = 'Minor',     link = 'Minor undead creatures',     symbol = '🧟' },
		full      = { text = 'Full',      link = 'Full undead creatures',      symbol = '💀' },
		greater   = { text = 'Greater',   link = 'Greater undead creatures',   symbol = '🧛' },
		outsider  = { text = 'Outsider',  link = 'Outsider creatures',         symbol = '👽️' },
		celestial = { text = 'Celestial', link = 'Celestial creatures',        symbol = '😇' },
		infernal  = { text = 'Infernal',  link = 'Infernal creatures',         symbol = '👿' },
		elemental = { text = 'Elemental', link = 'Elemental creatures',        symbol = '🌞' },
		plant     = { text = 'Plant',     link = 'Plant creatures',            symbol = '🌿' },
		construct = { text = 'Construct', link = 'Construct creatures',        symbol = '🗿' },
		draconic  = { text = 'Draconic',  link = 'Draconic creatures',         symbol = '🐲' },
		fae       = { text = 'Fae',       link = 'Fae creatures',              symbol = '🧚' },
		animal    = { text = 'Animal',    link = 'Animal creatures',           symbol = '🦀' },
		common    = { text = 'Common',    link = 'Common animal creatures',    symbol = '🐾' },
		ooze      = { text = 'Ooze',      link = 'Ooze creatures',             symbol = '💩' },
		monstrous = { text = 'Monstrous', link = 'Monstrous creatures',        symbol = '🧌' },
		humanoid  = { text = 'Humanoid',  link = 'Humanoid creatures',         symbol = '👤' },
		pc        = { text = 'Playable',	link = 'Player character creatures', symbol = '🧍' },
		partial   = { text = 'Partial',   link = 'Partial humanoid creatures', symbol = '🐒' },
		aquatic   = { text = 'Aquatic',   link = 'Aquatic creatures',          symbol = '🐟️' },
		-- angelic   = { text = 'Angelic',   link = 'Angelic creatures',          symbol = '😇' },
		-- demonic   = { text = 'Demonic',   link = 'Demonic creatures',          symbol = '👿' },
	}
}