익명
×
새 문서 만들기
여기에 문서 제목을 쓰세요:
We currently have 951 articles on 루리위키. Type your article name above or click on one of the titles below and start writing!



951Articles

모듈:샤인 포스트 Be your Idol/캐릭터 메모리: 두 판 사이의 차이

편집 요약 없음
편집 요약 없음
2번째 줄: 2번째 줄:


function p.render(frame)
function p.render(frame)
local args = frame.argsrgs
    -- 인자 처리 (직접 #invoke 대응)
    local args = frame.args
 
     local html = mw.html.create('table')
     local html = mw.html.create('table')
     html:addClass('wikitable')
     html:addClass('wikitable')
9번째 줄: 11번째 줄:
             ['border-collapse'] = 'collapse',
             ['border-collapse'] = 'collapse',
             ['word-break'] = 'break-all',
             ['word-break'] = 'break-all',
             ['table-layout'] = 'fixed' -- 셀 너비를 고정하기 위함
             ['table-layout'] = 'fixed'
         })
         })


     -- 테이블 헤더 생성
     -- 헤더
     local headerRow = html:tag('tr')
     local headerRow = html:tag('tr')
     headerRow:tag('th'):css({['background-color'] = '#3478bf', ['color'] = 'white', ['width'] = '20%'}):wikitext('메모리 타입')
     headerRow:tag('th')
     headerRow:tag('th'):css({['width'] = '45%'}):wikitext('메모리 이름')
        :css({ ['background-color'] = '#3478bf', ['color'] = 'white', ['width'] = '20%' })
     headerRow:tag('th'):css({['width'] = '35%'}):wikitext('게스트 메모리 시 참가자')
        :wikitext('메모리 타입')
     headerRow:tag('th')
        :css({ ['width'] = '45%' })
        :wikitext('메모리 이름')
     headerRow:tag('th')
        :css({ ['width'] = '35%' })
        :wikitext('게스트 메모리 시 참가자')


     local i = 1
     local i = 1
    local hasRow = false
     while args['타입' .. i] or args['이름' .. i] do
     while args['타입' .. i] or args['이름' .. i] do
         local m_type = args['타입' .. i] or ''
         hasRow = true
        local m_name = args['이름' .. i] or ''
        local m_guest = args['게스트' .. i] or ''
        local m_detail = args['내용' .. i] or ''


         -- 첫 번째 생성
        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')
        -- 1. 메모리 타입 셀
            :css('text-align', 'center')
         row:tag('td'):css('text-align', 'center'):wikitext(m_type)
            :wikitext(m_type)
       
 
        -- 2. 게스트 유무에 따른 이름 및 참가자 셀 처리
         if m_guest == '' then
         if m_guest == '' or m_guest == nil then
            -- 게스트가 없을 때: 이름 셀을 2칸 합침
             row:tag('td')
             row:tag('td')
                 :attr('colspan', '2')
                 :attr('colspan', '2')
39번째 줄: 49번째 줄:
                 :wikitext(m_name)
                 :wikitext(m_name)
         else
         else
            -- 게스트가 있을 때: 각각 표시하고 'with' 추가
             row:tag('td')
             row:tag('td'):css('font-weight', 'bold'):wikitext(m_name)
                :css('font-weight', 'bold')
                :wikitext(m_name)
             row:tag('td')
             row:tag('td')
                 :css('text-align', 'center')
                 :css('text-align', 'center')
46번째 줄: 57번째 줄:
         end
         end


         -- 세 번째 : 상세 내용 (전체 합침)
         -- 상세
         local detailRow = html:tag('tr')
         if m_detail ~= '' then
        detailRow:tag('td')
            local detailRow = html:tag('tr')
            :attr('colspan', '3')
            detailRow:tag('td')
            :css({
                :attr('colspan', '3')
                ['padding'] = '12px',
                :css({
                ['background-color'] = '#ffffff',
                    ['padding'] = '12px',
                ['border-bottom'] = '2px solid #3478bf'
                    ['background-color'] = '#ffffff',
            })
                    ['border-bottom'] = '2px solid #3478bf'
            :wikitext(m_detail)
                })
                :wikitext(m_detail)
        end


         i = i + 1
         i = i + 1
    end
    -- 데이터 없으면 아무것도 출력 안 함
    if not hasRow then
        return ''
     end
     end



2026년 1월 19일 (월) 02:50 판

메모리 타입메모리 이름게스트 메모리 시 참가자
교류 #1반짝이는 이미테이션
-
교류 #2이상의 아이돌
-

사용 예시

숫자를 늘리면 무한히 늘어납니다

{{#invoke:샤인 포스트 Be your Idol/캐릭터 메모리|render
|타입1 = 
|이름1 = 
|게스트1 =
|내용1 = 

|타입2 = 
|이름2 = 
|게스트2 = 
|내용2 = 
}}

local p = {}

function p.render(frame)
    -- 인자 처리 (직접 #invoke 대응)
    local args = frame.args

    local html = mw.html.create('table')
    html:addClass('wikitable')
        :css({
            ['width'] = '100%',
            ['border-collapse'] = 'collapse',
            ['word-break'] = 'break-all',
            ['table-layout'] = 'fixed'
        })

    -- 헤더
    local headerRow = html:tag('tr')
    headerRow:tag('th')
        :css({ ['background-color'] = '#3478bf', ['color'] = 'white', ['width'] = '20%' })
        :wikitext('메모리 타입')
    headerRow:tag('th')
        :css({ ['width'] = '45%' })
        :wikitext('메모리 이름')
    headerRow:tag('th')
        :css({ ['width'] = '35%' })
        :wikitext('게스트 메모리 시 참가자')

    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('text-align', 'center')
            :wikitext(m_type)

        if m_guest == '' then
            row:tag('td')
                :attr('colspan', '2')
                :css('font-weight', 'bold')
                :wikitext(m_name)
        else
            row:tag('td')
                :css('font-weight', 'bold')
                :wikitext(m_name)
            row:tag('td')
                :css('text-align', 'center')
                :wikitext('<span style="color:#666; font-size:0.9em;">with</span> ' .. m_guest)
        end

        -- 상세 행
        if m_detail ~= '' then
            local detailRow = html:tag('tr')
            detailRow:tag('td')
                :attr('colspan', '3')
                :css({
                    ['padding'] = '12px',
                    ['background-color'] = '#ffffff',
                    ['border-bottom'] = '2px solid #3478bf'
                })
                :wikitext(m_detail)
        end

        i = i + 1
    end

    -- 데이터 없으면 아무것도 출력 안 함
    if not hasRow then
        return ''
    end

    return tostring(html)
end

return p