(Gnlow (토론)의 4010판 편집을 되돌림)
태그: 편집 취소
편집 요약 없음
 
1번째 줄: 1번째 줄:
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
hangul = require("모듈:한글 처리")
local p = {}
-- Lua Library inline imports
local __TS__StringSplit
do
    local sub = string.sub
    local find = string.find
    function __TS__StringSplit(source, separator, limit)
        if limit == nil then
            limit = 4294967295
        end
        if limit == 0 then
            return {}
        end
        local result = {}
        local resultIndex = 1
        if separator == nil or separator == "" then
            for i = 1, #source do
                result[resultIndex] = sub(source, i, i)
                resultIndex = resultIndex + 1
            end
        else
            local currentPos = 1
            while resultIndex <= limit do
                local startPos, endPos = find(source, separator, currentPos, true)
                if not startPos then
                    break
                end
                result[resultIndex] = sub(source, currentPos, startPos - 1)
                resultIndex = resultIndex + 1
                currentPos = endPos + 1
            end
            if resultIndex <= limit then
                result[resultIndex] = sub(source, currentPos)
            end
        end
        return result
    end
end


local function __TS__StringAccess(self, index)
p = {}
    if index >= 0 and index < #self then
        return string.sub(self, index + 1, index + 1)
    end
end
 
---
-- @noSelfInFile *
_____CD08_C131 = "rRseEfaqQtTdwWczxvg"
_____C911_C131 = __TS__StringSplit("k o i O j p u P h hk ho hl y n nj np nl b m ml l", " ")
_____C885_C131 = __TS__StringSplit(" r R rt s sw sg e f fr fa fq ft fx fv fg a q qt t T d w c z x v g", " ")
function charCodeAt(char)
    local a, b, c = string.byte(char, 1, 3)
    return (a - 224) * 4096 + (b - 128) * 64 + c - 128 - 44032
end
function p.dksemfhdj(text)
    local result = string.gsub(
        text,
        "[^%c%p%s%w][^%c%p%s%w][^%c%p%s%w]",
        function(char)
            local code = charCodeAt(char)
            local _____CD08
            local _____C911
            local _____C885
            _____CD08 = math.floor(code / 588)
            code = code - _____CD08 * 588
            _____C911 = math.floor(code / 28)
            code = code - _____C911 * 28
            _____C885 = code
            return (__TS__StringAccess(_____CD08_C131, _____CD08) .. _____C911_C131[_____C911 + 1]) .. _____C885_C131[_____C885 + 1]
        end
    )
    return result
end


function p.translate(frame)
function p.translate(frame)
return p.dksemfhdj(frame.args[1])
return hangul.convert(
frame.args[1],
hangul.split("rRseEfaqQtTdwWczxvg", ""),
hangul.split("k o i O j p u P h hk ho hl y n nj np nl b m ml l", " "),
hangul.split(" r R rt s sw sg e f fr fa fq ft fx fv fg a q qt t T d w c z x v g", " ")
)
end
end


return p
return p

2022년 6월 18일 (토) 21:55 기준 최신판

이 모듈에 대한 설명문서는 모듈:Dksemfhdj/설명문서에서 만들 수 있습니다

hangul = require("모듈:한글 처리")

p = {} 

function p.translate(frame)
	return hangul.convert(
		frame.args[1],
		hangul.split("rRseEfaqQtTdwWczxvg", ""),
		hangul.split("k o i O j p u P h hk ho hl y n nj np nl b m ml l", " "),
		hangul.split(" r R rt s sw sg e f fr fa fq ft fx fv fg a q qt t T d w c z x v g", " ")
	)	
end

return p