Modül:RolBox: Revizyonlar arasındaki fark
Değişiklik özeti yok |
Değişiklik özeti yok |
||
| 23. satır: | 23. satır: | ||
local simgeList = simgeler ~= "" and splitList(simgeler) or {} | local simgeList = simgeler ~= "" and splitList(simgeler) or {} | ||
-- kritik badge | |||
local kritik_html = "" | local kritik_html = "" | ||
for _,v in ipairs(kritikList) do | for _,v in ipairs(kritikList) do | ||
kritik_html = kritik_html .. '<span class="fm- | kritik_html = kritik_html .. '<span class="fm-pill fm-pill-critical">' .. v .. '</span>' | ||
end | end | ||
-- ikinci badge | |||
local ikinci_html = "" | local ikinci_html = "" | ||
for _,v in ipairs(ikinciList) do | for _,v in ipairs(ikinciList) do | ||
ikinci_html = ikinci_html .. '<span class="fm- | ikinci_html = ikinci_html .. '<span class="fm-pill fm-pill-secondary">' .. v .. '</span>' | ||
end | end | ||
local | -- simgeler | ||
local simge_html = "" | |||
for _,v in ipairs(simgeList) do | |||
simge_html = simge_html .. '<span class="fm-icon">' .. v .. '</span>' | |||
end | end | ||
-- açıklama | |||
local aciklama_html = "" | local aciklama_html = "" | ||
if aciklama ~= "" then | if aciklama ~= "" then | ||
aciklama_html = string.format( | aciklama_html = string.format('<div class="fm-desc">%s</div>', aciklama) | ||
end | end | ||
local | -- ikinci alan varsa blok | ||
local ikinci_block = "" | |||
if ikinci ~= "" then | |||
ikinci_block = string.format([[ | |||
<tr> | |||
<th>İkincil Alanlar</th> | |||
<td>%s</td> | |||
</tr> | |||
]], ikinci_html) | |||
end | end | ||
return string.format([[ | return string.format([[ | ||
<div class="fm- | <div class="fm-rolebox-pro"> | ||
< | <table class="fm-table"> | ||
< | <tr> | ||
< | <th>Rol</th> | ||
</ | <td class="fm-name">%s</td> | ||
</tr> | |||
<tr> | |||
<th>Görev</th> | |||
<td class="fm-tag">%s</td> | |||
</tr> | |||
%s | |||
<tr> | |||
<th>Kritik Alanlar</th> | |||
<td>%s</td> | |||
</tr> | |||
<tr> | |||
<th>Simgeler</th> | |||
<td>%s</td> | |||
</tr> | |||
</table> | |||
%s | %s | ||
</div> | </div> | ||
]], | ]], | ||
isim, | isim, | ||
gorev, | gorev, | ||
ikinci_block, | |||
kritik_html, | kritik_html, | ||
simge_html, | |||
aciklama_html | |||
) | ) | ||
end | end | ||
return p | return p | ||
08.05, 4 Aralık 2025 tarihindeki hâli
Bu modül için bir Modül:RolBox/belge belgelendirmesi oluşturabilirsiniz
local p = {}
local function splitList(str)
local t = {}
for item in string.gmatch(str, "([^,]+)") do
table.insert(t, mw.text.trim(item))
end
return t
end
function p.render(frame)
local args = frame:getParent().args
local isim = args["isim"] or ""
local gorev = args["gorev"] or ""
local aciklama = args["aciklama"] or ""
local kritik = args["kritik"] or ""
local ikinci = args["ikinci"] or ""
local simgeler = args["simgeler"] or ""
local kritikList = kritik ~= "" and splitList(kritik) or {}
local ikinciList = ikinci ~= "" and splitList(ikinci) or {}
local simgeList = simgeler ~= "" and splitList(simgeler) or {}
-- kritik badge
local kritik_html = ""
for _,v in ipairs(kritikList) do
kritik_html = kritik_html .. '<span class="fm-pill fm-pill-critical">' .. v .. '</span>'
end
-- ikinci badge
local ikinci_html = ""
for _,v in ipairs(ikinciList) do
ikinci_html = ikinci_html .. '<span class="fm-pill fm-pill-secondary">' .. v .. '</span>'
end
-- simgeler
local simge_html = ""
for _,v in ipairs(simgeList) do
simge_html = simge_html .. '<span class="fm-icon">' .. v .. '</span>'
end
-- açıklama
local aciklama_html = ""
if aciklama ~= "" then
aciklama_html = string.format('<div class="fm-desc">%s</div>', aciklama)
end
-- ikinci alan varsa blok
local ikinci_block = ""
if ikinci ~= "" then
ikinci_block = string.format([[
<tr>
<th>İkincil Alanlar</th>
<td>%s</td>
</tr>
]], ikinci_html)
end
return string.format([[
<div class="fm-rolebox-pro">
<table class="fm-table">
<tr>
<th>Rol</th>
<td class="fm-name">%s</td>
</tr>
<tr>
<th>Görev</th>
<td class="fm-tag">%s</td>
</tr>
%s
<tr>
<th>Kritik Alanlar</th>
<td>%s</td>
</tr>
<tr>
<th>Simgeler</th>
<td>%s</td>
</tr>
</table>
%s
</div>
]],
isim,
gorev,
ikinci_block,
kritik_html,
simge_html,
aciklama_html
)
end
return p