모듈:scripts/templates
이 모듈에 대한 설명문서는 모듈:scripts/templates/설명문서에서 만들 수 있습니다
local export = {}
function export.exists(frame)
return require("Module:scripts").getByCode(
require("Module:parameters").process(frame.args, {
[1] = {required = true}
})[1]
) and "1" or ""
end
function export.getByCode(frame)
return require("Module:language-like").templateGetByCode(
require("Module: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("Module:scripts").getByCanonicalName(
require("Module:parameters").process(frame.args, {
[1] = {required = true}
})[1]
)
return sc and sc:getCode() or "None"
end
function export.findBestScript(frame)
local args = require("Module: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