편집하기 모듈:NameOrigin 0 문서 편집 권한이 없습니다. 다음의 이유를 확인해주세요: 요청한 동작은 다음 중 하나의 권한을 가진 사용자에게만 가능합니다: 사용자, FANDOM Staff, 위키아 헬퍼, Wiki Managers, Content Team Members. 편집하기 위해서는 등록된 사용자 계정으로 로그인이 필요합니다. 더 보기 + 문서의 원본을 보거나 복사할 수 있습니다: local p = {} local getArgs local scheme -- getColorScheme() -- @...{string(s)} local function getColorTable(colorKey) local default = scheme.others['표'] if colorKey == nil then return default end for category, dataset in pairs(scheme) do for key, value in pairs(dataset) do if key == colorKey then return value end end end return default end -- formatRowData() -- @args{table} -- @prefixes{table} local function formatRowData( args, prefixes ) local key, val, nextKey, nextVal, nextExists local vals = {} local index, nextIndex = 1 repeat nextIndex = index + 1 nextExists = false vals[index] = {} for i = 1, #prefixes do key = prefixes[i] .. index val = args[key] vals[index][i] = val or '' nextKey = prefixes[i] .. nextIndex nextExists = args[nextKey] and true end index = nextIndex until( not nextExists ) return vals end function p.main( frame ) if not getArgs then getArgs = require( 'Module:Arguments' ).getArgs end if not scheme then scheme = mw.loadData( 'Module:Color/Scheme' ) end local args = getArgs( frame ) local theadData = { '나라', '이름', '유래' } local tbodyData = formatRowData( args, theadData ) local tblData = { theadData } local tbl, thead, trow, tcell local primaryColor, secondaryColor primaryColor = getColorTable( args['타입1'] ) if not args['타입2'] then secondaryColor = primaryColor else secondaryColor = getColorTable( args['타입2'] ) end tbl = mw.html.create('table') tbl:addClass( 'rounded text-center' ) tbl:css( 'background', primaryColor[3] ) tbl:css( 'border', '4px solid ' .. secondaryColor[2] ) thead = tbl:tag( 'tr' ):css( 'background', primaryColor[1] ) for i = 1, #theadData do thead:tag( 'th' ):wikitext( theadData[i] ) end for i = 1, #tbodyData do trow = tbl:tag( 'tr' ):addClass( 'bg-white' ) tcell = tbodyData[i] for i = 1, #tcell do trow:tag( 'td' ):wikitext( tcell[i] ) end end return tbl:done() end return p 모듈:NameOrigin(으)로 돌아갑니다. 편집 요약 차이 보기