Модуль:Cite/DM
Материал из проекта «Повелитель Тайн Вики»
Дополнительные действия
local p = {}
function p.DMContent(frame)
local params = {}
local args = frame.args
table.insert(params, "Скрыть")
table.insert(params, [[ ]])
local en = args["en"]
if en ~= nil and en ~= "" then
table.insert(params, "Англ. перевод")
table.insert(params, en)
end
local cn = args["cn"]
if cn ~= nil and cn ~= "" then
table.insert(params, "Китайский")
table.insert(params, cn)
end
local img = args["img"]
if img ~= nil and img ~= "" then
table.insert(params, "Изображение")
table.insert(params, img)
end
local doc = args["doc"] or args["link"]
if doc ~= nil and doc ~= "" then
table.insert(params, "Ссылка на документ")
table.insert(params, doc)
end
if #params == 2 then
params[2] = [[{{color|red|'''Cite/DM: нет содержимого.'''}}]]
end
return require("Module:Tabber")._main(params, frame)
-- frame:preprocess(string.format([=[{{tabber|%s}}]=],table.concat(params, "|")))
-- return "<pre>" .. frame:preprocess("<nowiki>" .. res .. [[{{color|yellow|This template must remain with curly brackets}}]] .. "</nowiki>") .. "</pre>"
end
function p.userColours(frame)
local args = frame.args
local source = string.lower((args["source"] or args[1] or ""):gsub("%s+", ""))
local wechat_clr = "#00EB74"
local tbl = {
["windvally"] = "rgb(231, 76, 60)",
["cktalon"] = "rgb(255, 0, 0)",
["ck"] = "rgb(255, 0, 0)",
["cuttlefish"] = wechat_clr,
["cf"] = wechat_clr,
}
return tbl[source] or "#dc5622"
end
return p