문서 편집 권한이 없습니다. 다음 이유를 확인해주세요: 요청한 명령은 다음 권한을 가진 사용자에게 제한됩니다: 사용자. 문서의 원본을 보거나 복사할 수 있습니다. local p = {} -- CSV 데이터를 받아 wikitable 형식으로 변환하는 함수 function p.csv(frame) local csv = frame.args[1] or '' local lines = {} local result = '{| class="wikitable timetable" style="border: 2px solid var(--text);"\n' -- CSV 데이터를 줄 단위로 분리 for line in csv:gmatch("[^\r\n]+") do table.insert(lines, line) end for i = 1, #lines do local row = lines[i] local values = {} -- 데이터를 쉼표로 분리하여 values 테이블에 저장 for value in row:gmatch("[^,]+") do value = value:gsub("x", "…") value = value:gsub("/", "<br/>") value = value:gsub("v", "レ") value = value:gsub("i", "‖") table.insert(values, value) end for j, value in ipairs(values) do if j == 1 then values[j] = 'style="text-align: justify; text-align-last: justify; border-right: none;" |' .. value elseif j == 2 then values[j] = 'style="text-align: justify; text-align-last: justify; border-left: none; border-right: 1px solid var(--text);" |' .. value else values[j] = [[style="text-align: center; font-family: Monaco, 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace;" |]] .. value end end end for i = 1, #table_data do if i == 4 then result = result .. '|- style="border-bottom: double var(--text);"\n| ' .. table.concat(values, " || ") .. "\n" else result = result .. "|-\n| " .. table.concat(values, " || ") .. "\n" end for j = 1, #table_data[i] do local value = table_data[i][j] -- 병합 규칙 처리 local merge_flag = "" if value == "L" and j > 1 then merge_flag = ' colspan="2"' table_data[i][j] = nil -- L 셀은 삭제 elseif value == "R" and j < #table_data[i] then merge_flag = ' colspan="2"' table_data[i][j+1] = nil -- R 셀은 삭제하고 오른쪽 병합 elseif value == "U" and i > 1 then merge_flag = ' rowspan="2"' table_data[i][j] = nil -- U 셀은 삭제 elseif value == "D" and i < #table_data then merge_flag = ' rowspan="2"' table_data[i+1][j] = nil -- D 셀은 삭제하고 아래쪽 병합 end -- 병합된 셀 출력 if table_data[i][j] then result = result .. "| " .. table_data[i][j] .. merge_flag .. "\n" else result = result .. "| " .. merge_flag .. "\n" end end end result = result .. "|}" return result end return p 이 문서에서 사용한 틀: 모듈:Timetable/설명문서 (원본 보기) 모듈:Timetable 문서로 돌아갑니다.