Изменения

Модуль:Краткий вызов

1338 байтов добавлено, 07:16, 2 августа 2016
Новая страница: «p = {} p.shortcut = function(f) local args = require("Модуль:ProcessArgs").norm() local result = mw.html.create("table") result:addClass("noprint") r…»
p = {}

p.shortcut = function(f)
local args = require("Модуль:ProcessArgs").norm()

local result = mw.html.create("table")
result:addClass("noprint")
result:css({
["float"] = "right",
["clear"] = "right",
["margin-left"] = "0.75em",
["border"] = "1px solid #AFCFF2",
["font-size"] = "smaller"
})
result:attr("cellspacing", "0")

local tableRow = result:tag("tr")
local firstCell = tableRow:tag("td")
firstCell:css({
["background"] = "#F0F8FF",
["padding"] = "4px"
})
firstCell:wikitext("[[Файл:Redirectltr.png|20px|link=|Короткая ссылка-перенаправление|alt=↱]]")

local secondCell = tableRow:tag("td")
secondCell:css({
["background"] = "white",
["padding"] = "4px",
["vertical-align"] = "middle",
["line-height"] = "1.25em",
["font-weight"] = "bold"
})

local asTemplate = args["шаблон"] or "да"
if (asTemplate == "да") then
for index, value in ipairs(args) do
if index > 1 then
secondCell:tag("br")
end
secondCell:wikitext(f:expandTemplate({
["title"] = "ШаблонСсылка",
["args"] = {
value
}
}))
end
else
for index, value in ipairs(args) do
if index > 1 then
secondCell:tag("br")
end
secondCell:wikitext("[[" .. value .. "]]")
end
end

return tostring(result)
end

return p