편집 요약 없음 |
편집 요약 없음 |
||
| (같은 사용자의 중간 판 13개는 보이지 않습니다) | |||
| 2번째 줄: | 2번째 줄: | ||
function p.render(frame) | function p.render(frame) | ||
local args = frame. | local args = frame.args | ||
local html = mw.html.create('table') | local html = mw.html.create('table') | ||
html:addClass('wikitable') | html:addClass('wikitable') | ||
:css({ | :css({ | ||
['width'] = '100%', | ['width'] = '100%', | ||
['border-collapse'] = 'collapse', | ['border-collapse'] = 'collapse', | ||
['table-layout'] = 'fixed' | |||
['table-layout'] = 'fixed' | |||
}) | }) | ||
local i = 1 | |||
local | local hasRow = false | ||
while args['타입' .. i] or args['이름' .. i] do | while args['타입' .. i] or args['이름' .. i] do | ||
hasRow = true | |||
-- | local m_type = args['타입' .. i] or '' | ||
local m_name = args['이름' .. i] or '' | |||
local m_guest = args['게스트' .. i] or '' | |||
local m_detail = args['내용' .. i] or '' | |||
-- ① 요약 행 (외곽 상단) | |||
local row = html:tag('tr') | local row = html:tag('tr') | ||
-- | -- 타입 (색 있음) | ||
row:tag('td'):css('text-align', ' | row:tag('td') | ||
:css({ | |||
['background-color'] = '#3478bf', | |||
if m_guest == '' | ['color'] = 'white', | ||
-- | ['font-weight'] = 'bold', | ||
['text-align'] = 'center', | |||
['width'] = '20%', | |||
['border-top'] = '2px solid #000', | |||
['border-left'] = '2px solid #000' | |||
}) | |||
:wikitext(m_type) | |||
if m_guest == '' then | |||
-- 게스트 없음 → 이름 2칸 합침 | |||
row:tag('td') | row:tag('td') | ||
:attr('colspan', '2') | :attr('colspan', '2') | ||
:css('font-weight', ' | :css({ | ||
['font-weight'] = 'bold', | |||
['border-top'] = '2px solid #000', | |||
['border-right'] = '2px solid #000' | |||
}) | |||
:wikitext(m_name) | :wikitext(m_name) | ||
else | else | ||
-- | -- 이름 | ||
row:tag('td') | row:tag('td') | ||
:css(' | :css({ | ||
:wikitext(' | ['font-weight'] = 'bold', | ||
['width'] = '65%', | |||
['border-top'] = '2px solid #000' | |||
}) | |||
:wikitext(m_name) | |||
-- 게스트 | |||
row:tag('td') | |||
:css({ | |||
['text-align'] = 'center', | |||
['width'] = '15%', | |||
['border-top'] = '2px solid #000', | |||
['border-right'] = '2px solid #000' | |||
}) | |||
:wikitext('with ' .. m_guest) | |||
end | end | ||
-- | -- ② 상세 행 (외곽 하단) | ||
local detailRow = html:tag('tr') | if m_detail ~= '' then | ||
local detailRow = html:tag('tr') | |||
detailRow:tag('td') | |||
:attr('colspan', '3') | |||
:css({ | |||
['padding'] = '10px', | |||
['border-left'] = '2px solid #000', | |||
['border-right'] = '2px solid #000', | |||
['border-bottom'] = '2px solid #000' | |||
}) | |||
:wikitext(m_detail) | |||
else | |||
-- 상세 없을 때도 하단 외곽선 닫기 | |||
row:allDone() | |||
row:tag('td') | |||
end | |||
i = i + 1 | i = i + 1 | ||
end | |||
if not hasRow then | |||
return '' | |||
end | end | ||
2026년 1월 19일 (월) 03:32 기준 최신판
| 교류 #1 | 반짝이는 이미테이션 | |
| - | ||
| 교류 #2 | 이상의 아이돌 | |
| - | ||
사용 예시
숫자를 늘리면 무한히 늘어납니다
{{#invoke:샤인 포스트 Be your Idol/캐릭터 메모리|render
|타입1 =
|이름1 =
|게스트1 =
|내용1 =
|타입2 =
|이름2 =
|게스트2 =
|내용2 =
}}
local p = {}
function p.render(frame)
local args = frame.args
local html = mw.html.create('table')
html:addClass('wikitable')
:css({
['width'] = '100%',
['border-collapse'] = 'collapse',
['table-layout'] = 'fixed'
})
local i = 1
local hasRow = false
while args['타입' .. i] or args['이름' .. i] do
hasRow = true
local m_type = args['타입' .. i] or ''
local m_name = args['이름' .. i] or ''
local m_guest = args['게스트' .. i] or ''
local m_detail = args['내용' .. i] or ''
-- ① 요약 행 (외곽 상단)
local row = html:tag('tr')
-- 타입 (색 있음)
row:tag('td')
:css({
['background-color'] = '#3478bf',
['color'] = 'white',
['font-weight'] = 'bold',
['text-align'] = 'center',
['width'] = '20%',
['border-top'] = '2px solid #000',
['border-left'] = '2px solid #000'
})
:wikitext(m_type)
if m_guest == '' then
-- 게스트 없음 → 이름 2칸 합침
row:tag('td')
:attr('colspan', '2')
:css({
['font-weight'] = 'bold',
['border-top'] = '2px solid #000',
['border-right'] = '2px solid #000'
})
:wikitext(m_name)
else
-- 이름
row:tag('td')
:css({
['font-weight'] = 'bold',
['width'] = '65%',
['border-top'] = '2px solid #000'
})
:wikitext(m_name)
-- 게스트
row:tag('td')
:css({
['text-align'] = 'center',
['width'] = '15%',
['border-top'] = '2px solid #000',
['border-right'] = '2px solid #000'
})
:wikitext('with ' .. m_guest)
end
-- ② 상세 행 (외곽 하단)
if m_detail ~= '' then
local detailRow = html:tag('tr')
detailRow:tag('td')
:attr('colspan', '3')
:css({
['padding'] = '10px',
['border-left'] = '2px solid #000',
['border-right'] = '2px solid #000',
['border-bottom'] = '2px solid #000'
})
:wikitext(m_detail)
else
-- 상세 없을 때도 하단 외곽선 닫기
row:allDone()
row:tag('td')
end
i = i + 1
end
if not hasRow then
return ''
end
return tostring(html)
end
return p