교류 #1 | 반짝이는 이미테이션+없음 | |
▼ 상세 상세 내용이 없습니다. | ||
교류 #2 | 이상의 아이돌+없음 | |
▼ 상세 상세 내용이 없습니다. | ||
사용 예시
숫자를 늘리면 무한히 늘어납니다
{{#invoke:샤인 포스트 Be your Idol/캐릭터 메모리|render
|타입1 =
|이름1 =
|게스트1 =
|스텟1
|내용1 =
|타입2 =
|이름2 =
|게스트2 =
|스텟2=
|내용2 =
}}
local p = {}
function p.render(f)
local a, has, h = {}, false, mw.html.create('table'):addClass('wikitable'):css{
width = '100%',
['border-collapse'] = 'collapse',
['table-layout'] = 'fixed',
border = '2px solid #000',
marginBottom = '20px'
}
local pnt = f:getParent()
if pnt then for k, v in pairs(pnt.args) do a[k] = v end end
for k, v in pairs(f.args) do a[k] = v end
for i = 1, 50 do
local t = a['타입' .. i] or ''
local n = a['이름' .. i] or ''
local g = a['게스트' .. i] or ''
local s = a['스텟' .. i] or ''
local d = a['내용' .. i] or ''
if t ~= '' or n ~= '' then
has = true
local r = h:tag('tr')
-- ▶ 타입 (탭 스타일)
r:tag('td'):css{
background = '#3478bf',
color = '#fff',
width = '20%',
border = '2px solid #000',
position = 'relative'
}:wikitext(
"<div style='position:relative;padding:6px 10px;font-weight:bold;'>" ..
t ..
"<span style='position:absolute;right:-10px;top:0;width:0;height:0;border-top:14px solid transparent;border-bottom:14px solid transparent;border-left:10px solid #3478bf;'></span>" ..
"</div>"
)
local statText = (s ~= '' and s or '없음')
-- ▶ 게스트 없음 (2칸)
if g == '' or g:match '^%s*$' then
r:tag('td'):attr('colspan', 2):css{
fontWeight = 'bold',
border = '2px solid #000',
padding = '6px 10px'
}:wikitext(
"<div style='display:flex;justify-content:space-between;align-items:center;'>" ..
"<span style='font-size:1.05em;'>" .. n .. "</span>" ..
"<span style='font-size:.85em;color:#2c5d9f;'>+" .. statText .. "</span>" ..
"</div>"
)
-- ▶ 게스트 있음 (3칸)
else
-- 이름
r:tag('td'):css{
fontWeight = 'bold',
width = '60%',
borderTop = '2px solid #000',
borderBottom = '2px solid #000',
borderLeft = '0',
borderRight = '0',
padding = '6px 10px'
}:wikitext(
"<span style='font-size:1.05em;'>" .. n .. "</span>"
)
-- 게스트 (보조 정보처럼)
r:tag('td'):css{
textAlign = 'right',
width = '20%',
borderTop = '2px solid #000',
borderBottom = '2px solid #000',
borderLeft = '0',
borderRight = '2px solid #000',
padding = '6px 10px',
color = '#666',
fontSize = '.85em'
}:wikitext(
"👥 " .. g .. "<br><span style='color:#2c5d9f;'>+" .. statText .. "</span>"
)
end
-- ▶ 상세 (접기)
local c = h:tag('tr'):tag('td'):attr('colspan', 3):css{
padding = 0,
border = '2px solid #000'
}:tag('div'):addClass('mw-collapsible mw-collapsed')
c:tag('div'):addClass('mw-collapsible-toggle'):css{
textAlign = 'center',
background = '#dbe5f1',
fontSize = '.85em',
padding = '5px',
fontWeight = 'bold'
}:wikitext('▼ 상세')
c:tag('div'):addClass('mw-collapsible-content'):css{
padding = '12px',
background = '#fff',
borderTop = '2px solid #ccc'
}:wikitext((d ~= '' and d ~= '-') and d or '상세 내용이 없습니다.')
end
end
return has and tostring(h) or "<div style='color:red;font-weight:bold'>데이터를 찾을 수 없습니다.</div>"
end
return p