Модуль:Entity Lookup: различия между версиями
Pok (обсуждение | вклад) Нет описания правки |
Pok (обсуждение | вклад) Нет описания правки |
||
| (не показаны 3 промежуточные версии этого же участника) | |||
| Строка 13: | Строка 13: | ||
local function buildName(entity, useSuffix) | local function buildName(entity, useSuffix) | ||
local name = entity.name or "" | local name = entity.name or "" | ||
local label = mw. | local label = mw.ustring.lower(entity.label or "") | ||
local suffix = "" | local suffix = "" | ||
if useSuffix then | if useSuffix then | ||
suffix = mw.ustring.lower(entity.suffix or "") | |||
if | |||
if suffix ~= "" then | |||
local parts = {} | local parts = {} | ||
for part in tostring( | for part in tostring(suffix):gmatch("[^,;]+") do | ||
part = mw.text.trim(part) | part = mw.text.trim(part) | ||
if part ~= "" then | if part ~= "" then | ||
| Строка 26: | Строка 27: | ||
end | end | ||
end | end | ||
suffix = table.concat(parts, ", ") | |||
end | end | ||
end | end | ||
| Строка 57: | Строка 56: | ||
local override = p.name_overrides[id] | local override = p.name_overrides[id] | ||
if override then | if override then | ||
return override | return lower(override) | ||
end | end | ||
| Строка 65: | Строка 64: | ||
end | end | ||
local useSuffix = frame.args and frame.args.suffix and | local useSuffix = frame.args and frame.args.suffix and frame.args.suffix ~= "" | ||
return buildName(entity, useSuffix) | return buildName(entity, useSuffix) | ||
end | end | ||