Перейти к содержимому страницы
Переключить меню
Переключить меню настроек
Переключить персональное меню
Вы не представились системе
Ваш IP-адрес будет виден всем, если вы внесёте какие-либо изменения.
Сообщество «Повелителя Тайн»Telegram — новости, дунхуа, игры и мерчDiscord — обсуждение книг и теорий, вопросы по вики

Модуль: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