Модуль: Infobox tmp: различия между версиями 🔗
Материал из VEDA Wiki
Sphynkx (обсуждение | вклад) Нет описания правки Метка: ручная отмена |
Sphynkx (обсуждение | вклад) Нет описания правки |
||
Строка 2: | Строка 2: | ||
function p.event_members( frame ) | function p.event_members( frame ) | ||
local t = {} | local t = {[[<table border=1> | ||
<tr><td align="left" width="10%" bgcolor="#{{#dplvar:boxbgcolor}}" style="font-weight: bold;">line1</td><td>xxx</td></tr> | |||
<tr><td colspan=2> | |||
<div {{DivWrapOpts}}>\[\[Категория:WrapBlock\]\] | |||
<table border=2 width=100%><tr><td colspan="2" bgcolor="#{{#dplvar:boxbgcolor}}" style="font-weight: bold; text-align: center;">xxx</td></tr></table> | |||
<div class="mw-collapsible-content"> | |||
<table border=3> | |||
]]} | |||
local name = frame.args[1] | local name = frame.args[1] | ||
for i in string.gmatch(name, "[^;]+") do | for i in string.gmatch(name, "[^;]+") do | ||
Строка 49: | Строка 59: | ||
end -- 'for i' cycle | end -- 'for i' cycle | ||
table.insert(t, [[<tr> | table.insert(t, [[</table> | ||
</div></div> | |||
</td></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>не менее |
Версия от 17:27, 2 октября 2024
Для документации этого модуля может быть создана страница Модуль:Infobox tmp/doc
local p = {} -- p stands for package
function p.event_members( frame )
local t = {[[<table border=1>
<tr><td align="left" width="10%" bgcolor="#{{#dplvar:boxbgcolor}}" style="font-weight: bold;">line1</td><td>xxx</td></tr>
<tr><td colspan=2>
<div {{DivWrapOpts}}>\[\[Категория:WrapBlock\]\]
<table border=2 width=100%><tr><td colspan="2" bgcolor="#{{#dplvar:boxbgcolor}}" style="font-weight: bold; text-align: center;">xxx</td></tr></table>
<div class="mw-collapsible-content">
<table border=3>
]]}
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, [[</table>
</div></div>
</td></tr>
<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