Модуль:Infoboxes: различия между версиями
Kraskaska (обсуждение | вклад) Нет описания правки |
Kraskaska (обсуждение | вклад) Нет описания правки |
||
(не показано 35 промежуточных версий 2 участников) | |||
Строка 2: | Строка 2: | ||
function p.player(frame) | function p.player(frame) | ||
local name = frame.args[1] | local name = frame.args[1] | ||
return " | local role = frame.args["role"] | ||
local discord = frame.args["discord"] | |||
local tabl = "" | |||
if discord ~= nil or role ~= nil then | |||
if role ~= nil and role:gsub("^%s*(.-)%s*$", "%1") ~= "" then | |||
tabl = tabl.."|'''Роль'''||"..role.."\n|-\n" | |||
end | |||
if discord ~= nil and discord:gsub("^%s*(.-)%s*$", "%1") ~= "" then | |||
tabl = tabl.."|'''Discord'''||"..discord.."\n|-\n" | |||
end | |||
end | |||
return [[ | |||
<div style="float:right;"> | |||
{| style="padding:1rem;background-color:#00ffff29" | |||
|colspan="2"|<div style="display:flex;gap:1rem;align-items:center"> | |||
https://mc-heads.net/avatar/]]..name..[[/32.png | |||
<p>]]..name..[[</p> | |||
</div> | |||
|- | |||
]]..tabl..[[ | |||
|} | |||
</div> | |||
]] | |||
end | |||
function p.country(frame) | |||
local name = frame.args[1] | |||
local ruler = frame.args["ruler"] | |||
local system = frame.args["system"] -- democracy or autocracy, etc | |||
local ideology = frame.args["ideology"] -- monarchy or republic, etc | |||
return [[ | |||
<div style="float:right;"> | |||
{| style="padding:1rem;background-color:#00ffff29" | |||
|colspan="2"|<center style="font-size: 1.5em">''']]..name..[['''</center> | |||
|- | |||
|'''Правитель'''||]]..ruler..[[ | |||
|- | |||
|'''[https://ru.wikipedia.org/wiki/%D0%9F%D0%BE%D0%BB%D0%B8%D1%82%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B0%D1%8F_%D1%81%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%B0 Система]'''||]]..system..[[ | |||
|- | |||
|'''[https://ru.wikipedia.org/wiki/%D0%98%D0%B4%D0%B5%D0%BE%D0%BB%D0%BE%D0%B3%D0%B8%D1%8F Идеология]'''||]]..ideology..[[ | |||
|} | |||
</div> | |||
]] | |||
end | |||
function p.war(frame) | |||
local name = frame.args[1] | |||
return [[ | |||
<div style="float:right;"> | |||
{| style="padding:1rem;background-color:#00ffff29 | |||
|colspan="2"|<center style="font-size: 1.5em">''']]..name..[['''</center> | |||
|} | |||
</div> | |||
]] | |||
end | end | ||
return p | return p |
Текущая версия от 11:29, 14 марта 2024
Для документации этого модуля может быть создана страница Модуль:Infoboxes/doc
local p = {}
function p.player(frame)
local name = frame.args[1]
local role = frame.args["role"]
local discord = frame.args["discord"]
local tabl = ""
if discord ~= nil or role ~= nil then
if role ~= nil and role:gsub("^%s*(.-)%s*$", "%1") ~= "" then
tabl = tabl.."|'''Роль'''||"..role.."\n|-\n"
end
if discord ~= nil and discord:gsub("^%s*(.-)%s*$", "%1") ~= "" then
tabl = tabl.."|'''Discord'''||"..discord.."\n|-\n"
end
end
return [[
<div style="float:right;">
{| style="padding:1rem;background-color:#00ffff29"
|colspan="2"|<div style="display:flex;gap:1rem;align-items:center">
https://mc-heads.net/avatar/]]..name..[[/32.png
<p>]]..name..[[</p>
</div>
|-
]]..tabl..[[
|}
</div>
]]
end
function p.country(frame)
local name = frame.args[1]
local ruler = frame.args["ruler"]
local system = frame.args["system"] -- democracy or autocracy, etc
local ideology = frame.args["ideology"] -- monarchy or republic, etc
return [[
<div style="float:right;">
{| style="padding:1rem;background-color:#00ffff29"
|colspan="2"|<center style="font-size: 1.5em">''']]..name..[['''</center>
|-
|'''Правитель'''||]]..ruler..[[
|-
|'''[https://ru.wikipedia.org/wiki/%D0%9F%D0%BE%D0%BB%D0%B8%D1%82%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B0%D1%8F_%D1%81%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%B0 Система]'''||]]..system..[[
|-
|'''[https://ru.wikipedia.org/wiki/%D0%98%D0%B4%D0%B5%D0%BE%D0%BB%D0%BE%D0%B3%D0%B8%D1%8F Идеология]'''||]]..ideology..[[
|}
</div>
]]
end
function p.war(frame)
local name = frame.args[1]
return [[
<div style="float:right;">
{| style="padding:1rem;background-color:#00ffff29
|colspan="2"|<center style="font-size: 1.5em">''']]..name..[['''</center>
|}
</div>
]]
end
return p