More actions
Arvid Varg (talk | contribs) No edit summary |
Arvid Varg (talk | contribs) No edit summary |
||
| Line 17: | Line 17: | ||
function p.stripHouse(frame) | function p.stripHouse(frame) | ||
local name = | local name = frame.args[1] or "" | ||
local prefixes = { "House", "Clan", "Family", "Dynasty" } | local prefixes = { "House", "Clan", "Family", "Dynasty" } | ||
for _, prefix in ipairs(prefixes) do | for _, prefix in ipairs(prefixes) do | ||
local pattern = "^" .. | local pattern = "^" .. prefix .. "%s+" | ||
name = mw.ustring.gsub(name, | name = mw.ustring.gsub(name, pattern, "") | ||
end | end | ||
Revision as of 21:08, 30 March 2026
Titles
! colspan="2" class="infobox-subheader" | Not on a character |-
! colspan="2" class="infobox-subheader" |
|-
| Gnoblin | |
|---|---|
| Using the template | |
| Gnoblin | |
|---|---|
| Simple name only | |
local p = {}
function p.processTitle(frame)
local input = frame.args[1] or ""
-- Check if input already looks like a {{Title}} template
if mw.ustring.match(input, "^%s*%{%{%s*[Tt]itle%s*[|}]") then
return input
end
-- Otherwise, expand the template properly
return frame:expandTemplate{
title = "Title",
args = { name = input }
}
end
function p.stripHouse(frame)
local name = frame.args[1] or ""
local prefixes = { "House", "Clan", "Family", "Dynasty" }
for _, prefix in ipairs(prefixes) do
local pattern = "^" .. prefix .. "%s+"
name = mw.ustring.gsub(name, pattern, "")
end
return name
end
return p