편집 요약 없음 |
편집 요약 없음 |
||
46번째 줄: | 46번째 줄: | ||
function p.convert(frame) | function p.convert(frame) | ||
local input = frame.args[1] or "" | local input = frame.args[1] or "" | ||
-- 디버그: 입력값 출력 | |||
mw.log("Input:", input) | |||
if input == "" then | |||
return "Error: No input provided." | |||
end | |||
local result = "" | local result = "" | ||
-- UTF-8 문자별로 처리 | -- UTF-8 문자별로 처리 | ||
for char in input:gmatch(utf8_charpattern) do | for char in input:gmatch(utf8_charpattern) do | ||
-- 디버그: 현재 문자와 변환 결과 출력 | |||
mw.log("Processing char:", char) | |||
local converted = conversionTable[char:lower()] or char | |||
mw.log("Converted char:", converted) | |||
result = result .. converted | |||
end | end | ||
-- 디버그: 최종 결과 출력 | |||
mw.log("Result:", result) | |||
return result | return result | ||
end | end | ||
return p | return p |
2025년 4월 21일 (월) 01:41 판
이 모듈에 대한 설명문서는 모듈:WingdingEncoding/설명문서에서 만들 수 있습니다
local p = {}
-- UTF-8 문자 패턴 정의 (Lua 5.1 호환)
local utf8_charpattern = "[%z\1-\127\194-\244][\128-\191]*"
-- 변환 테이블 정의
local conversionTable = {
["A"] = "✌",
["B"] = "👌",
["C"] = "👍",
["D"] = "👎",
["E"] = "☜",
["F"] = "☞",
["G"] = "☝",
["H"] = "☟",
["I"] = "✋",
["J"] = "☺",
["K"] = "😐",
["L"] = "☹",
["M"] = "💣",
["N"] = "☠",
["O"] = "⚐",
["P"] = "🏱",
["Q"] = "✈",
["R"] = "☼",
["S"] = "💧",
["T"] = "❄",
["U"] = "🕆",
["V"] = "✞",
["W"] = "🕈",
["X"] = "✠",
["Y"] = "✡",
["Z"] = "☪",
["."] = "📬",
[","] = "📪",
["?"] = "✍",
["!"] = "✏",
["("] = "☎",
[")"] = "✆",
["'"] = "🕯",
["\""] = "✂",
["~"] = "❞"
}
-- 변환 함수
function p.convert(frame)
local input = frame.args[1] or ""
-- 디버그: 입력값 출력
mw.log("Input:", input)
if input == "" then
return "Error: No input provided."
end
local result = ""
-- UTF-8 문자별로 처리
for char in input:gmatch(utf8_charpattern) do
-- 디버그: 현재 문자와 변환 결과 출력
mw.log("Processing char:", char)
local converted = conversionTable[char:lower()] or char
mw.log("Converted char:", converted)
result = result .. converted
end
-- 디버그: 최종 결과 출력
mw.log("Result:", result)
return result
end
return p