Модуль:CountryCases
ХӀокху модулах лаьцна хааман Модуль:CountryCases/doc агӀо кхолла мега
local p = {}
local brackets = "%[%[(.+)%]%]"
function p._debracket(s)
return mw.ustring.match(s, brackets) or s
end
local countries = require('Модуль:CountryCases/data')
function p._genitive(frame, s)
local country = p._debracket(s)
if countries[country] ~= nil and countries[country].gen ~= nil then
return countries[country].gen
end
return frame:callParserFunction('#ifexist', {country, country})
end
function p._locative(frame, s)
local country = p._debracket(s)
if countries[country] ~= nil then
return countries[country].loc
end
local ru = require('Модуль:Ce')
return 'в ' .. ru.locative(frame)
end
local function wrapper(frame, func_name)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
local args = getArgs(frame)
return p[func_name](frame, args[1])
end
function p.genitive(frame)
return wrapper(frame, '_genitive')
end
function p.locative(frame)
return wrapper(frame, '_locative')
end
return p