Modul:scripts/templates
Napohlad
Dokumentacija za tutón modul hodźi so na Modul:scripts/templates/dokumentacija wutworić
local export = {}
function export.exists(frame)
return require("Modul:scripts").getByCode(
require("Modul:parameters").process(frame.args, {
[1] = {required = true}
})[1]
) and "1" or ""
end
function export.getByCode(frame)
return require("Modul:language-like").templateGetByCode(
require("Modul:parameters").process(frame.args, {
[1] = {required = true, type = "script"},
[2] = {required = true},
[3] = {}
}),
function(itemname)
if itemname == "countCharacters" then
local text = args[3] or ""
return args[1]:countCharacters(text)
end
end
)
end
function export.getByCanonicalName(frame)
local sc = require("Modul:scripts").getByCanonicalName(
require("Modul:parameters").process(frame.args, {
[1] = {required = true}
})[1]
)
return sc and sc:getCode() or "None"
end
function export.findBestScript(frame)
local args = require("Modul:parameters").process(frame.args, {
[1] = {required = true},
[2] = {required = true, type = "language"},
[3] = {}
})
if args[3] == "getCanonicalName" then
return args[2]:findBestScript(args[1]):getCanonicalName()
else
return args[2]:findBestScript(args[1]):getCode()
end
end
return export