Cafeinlove (메시지 담벼락 | 기여) 잔글편집 요약 없음 태그: sourceedit |
Cafeinlove (메시지 담벼락 | 기여) 잔글편집 요약 없음 태그: sourceedit |
||
(같은 사용자의 중간 판 3개는 보이지 않습니다) | |||
6번째 줄: | 6번째 줄: | ||
local function switcherItems( text, bgColor, borderColor ) |
local function switcherItems( text, bgColor, borderColor ) |
||
− | return '<tr style="background: ' .. bgColor .. '; border: 2px solid ' .. borderColor .. '; border-radius: |
+ | return '<tr><td class="font-weight-bold" style="background: ' .. bgColor .. '; border: 2px solid ' .. borderColor .. '; border-radius: 10px;">[[#|<span style="color: #111">' .. text .. '</span>]]</td></tr>' |
end |
end |
||
19번째 줄: | 19번째 줄: | ||
local items = {} |
local items = {} |
||
− | if type1 ~= nil and typeScheme[type1] then color1 = typeScheme[type1] end |
+ | if type1 ~= nil and typeScheme[type1] then color1, color2 = typeScheme[type1] end |
− | if type2 ~= nil and typeScheme[type2] then color2 = typeScheme[ |
+ | if type2 ~= nil and typeScheme[type2] then color2 = typeScheme[type2] end |
for key, value in ipairs( args ) do |
for key, value in ipairs( args ) do |
||
28번째 줄: | 28번째 줄: | ||
end |
end |
||
− | local ret = '<table id="pokemonToggle" class="float-right mb-1 ml-1 text-center rounded" style="background: ' .. color1[2] .. '; border: 4px solid ' .. color1[3] .. ';"><tr><th>' .. title .. '</th></tr>' .. table.concat( items ) .. '</table>' |
+ | local ret = '<table id="pokemonToggle" class="float-right mb-1 ml-1 text-center rounded" style="background: ' .. color1[2] .. '; border: 4px solid ' .. color1[3] .. '; border-spacing: 4px;"><tr><th>' .. title .. '</th></tr>' .. table.concat( items ) .. '</table>' |
return ret |
return ret |
2017년 1월 23일 (월) 13:13 기준 최신판
이 모듈에 대한 설명문서는 모듈:Infobox/설명문서에서 만들 수 있습니다
local infobox = {}
local getArgs = require( 'Module:Arguments' ).getArgs
local scheme = mw.loadData( 'Module:Color/Scheme' ) -- 전체 색상표
local typeScheme = scheme.types -- 타입 색상표
local function switcherItems( text, bgColor, borderColor )
return '<tr><td class="font-weight-bold" style="background: ' .. bgColor .. '; border: 2px solid ' .. borderColor .. '; border-radius: 10px;">[[#|<span style="color: #111">' .. text .. '</span>]]</td></tr>'
end
function infobox.switcher( frame )
local args = getArgs( frame )
if args[1] == nil then return '' end
local type1, type2 = args['타입1'], args['타입2']
local color1, color2 = typeScheme['표']
local title = args['제목'] or ''
local items = {}
if type1 ~= nil and typeScheme[type1] then color1, color2 = typeScheme[type1] end
if type2 ~= nil and typeScheme[type2] then color2 = typeScheme[type2] end
for key, value in ipairs( args ) do
if type( key ) == 'number' then
table.insert( items, switcherItems( value, color1[1], color2[2] ) )
end
end
local ret = '<table id="pokemonToggle" class="float-right mb-1 ml-1 text-center rounded" style="background: ' .. color1[2] .. '; border: 4px solid ' .. color1[3] .. '; border-spacing: 4px;"><tr><th>' .. title .. '</th></tr>' .. table.concat( items ) .. '</table>'
return ret
end
return infobox