Модуль: Infobox tmp: различия между версиями 🔗
Материал из VEDA Wiki
Sphynkx (обсуждение | вклад) Нет описания правки Метка: отменено |
Sphynkx (обсуждение | вклад) Нет описания правки Метка: ручная отмена |
||
Строка 2: | Строка 2: | ||
function p.event_members( frame ) | function p.event_members( frame ) | ||
local t = { | local t = {} | ||
local name = frame.args[1] | local name = frame.args[1] | ||
for i in string.gmatch(name, "[^;]+") do | for i in string.gmatch(name, "[^;]+") do | ||
Строка 42: | Строка 37: | ||
table.insert(t, | table.insert(t, | ||
[[ | [[<tr> | ||
<tr> | |||
<td colspan="2"><hr></td> | <td colspan="2"><hr></td> | ||
</tr><tr> | </tr><tr> | ||
Строка 57: | Строка 49: | ||
end -- 'for i' cycle | end -- 'for i' cycle | ||
table.insert(t, [[ | table.insert(t, [[<tr> | ||
<tr> | |||
<td align="left" width="10%" bgcolor="#{{#dplvar:boxbgcolor}}" style="font-weight: bold;">Общее число:</td> | <td align="left" width="10%" bgcolor="#{{#dplvar:boxbgcolor}}" style="font-weight: bold;">Общее число:</td> | ||
<td>не менее | <td>не менее |
Версия от 16:30, 2 октября 2024
Для документации этого модуля может быть создана страница Модуль:Infobox tmp/doc
local p = {} -- p stands for package
function p.event_members( frame )
local t = {}
local name = frame.args[1]
for i in string.gmatch(name, "[^;]+") do
local field2 = ''
local field3 = ''
table.insert(t, [[<tr>
<td colspan="2" bgcolor="#{{#dplvar:boxbgcolor}}" style="font-weight: bold; text-align: center;">Участник</td>
</tr>]])
local l = {}
for k in string.gmatch(i, "[^!]+") do
table.insert(l, k)
end
if l[2] == nil or l[2] == '' or l[2] == ' ' then
field2 = ''
else
field2 = [[<tr>
<td colspan="2"><hr></td>
</tr><tr>
<td align="left" width="10%" bgcolor="#{{#dplvar:boxbgcolor}}" style="font-weight: bold;">Категория:</td>
<td>]]..l[2]..'</td></tr>'
end -- if l[2]
if l[3] == nil or l[3] == '' or l[3] == ' ' then
field3 = ''
else
field3 = [[<tr>
<td colspan="2"><hr></td>
</tr><tr>
<td align="left" width="10%" bgcolor="#{{#dplvar:boxbgcolor}}" style="font-weight: bold;">Количество:</td>
<td>]]..l[3]..'</td></tr>'
end -- if l[3]
table.insert(t,
[[<tr>
<td colspan="2"><hr></td>
</tr><tr>
<td align="left" width="10%" bgcolor="#{{#dplvar:boxbgcolor}}" style="font-weight: bold;">Участник:</td>
<td>]]..l[1]..'</td></tr>'
..
field2
..
field3)
end -- 'for i' cycle
table.insert(t, [[<tr>
<td align="left" width="10%" bgcolor="#{{#dplvar:boxbgcolor}}" style="font-weight: bold;">Общее число:</td>
<td>не менее
]] .. #t/2 .. '</td></tr>')
return table.concat(t, "")
end
return p