Jump to content

Module:Hepburner: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
there we (actually) go :)
no long i, oops!
Line 5: Line 5:
local diacritics = {
local diacritics = {
["aa"] = "ā",
["aa"] = "ā",
["ii"] = "ī",
["uu"] = "ū",
["uu"] = "ū",
["ee"] = "ē",
["ee"] = "ē",
Line 11: Line 10:
["ou"] = "ō",
["ou"] = "ō",
["Aa"] = "Ā",
["Aa"] = "Ā",
["Ii"] = "Ī",
["Uu"] = "Ū",
["Uu"] = "Ū",
["Ee"] = "Ē",
["Ee"] = "Ē",
Line 17: Line 15:
["Ou"] = "Ō",
["Ou"] = "Ō",
["AA"] = "Ā",
["AA"] = "Ā",
["II"] = "Ī",
["UU"] = "Ū",
["UU"] = "Ū",
["EE"] = "Ē",
["EE"] = "Ē",

Revision as of 03:37, 3 March 2024

require('strict');
-- Converts romanji input to modified hepburn, I recommend subst:ing

-- standard long vowel patterns
local diacritics = {
    ["aa"] = "ā",
    ["uu"] = "ū",
    ["ee"] = "ē",
    ["oo"] = "ō",
    ["ou"] = "ō",
    ["Aa"] = "Ā",
    ["Uu"] = "Ū",
    ["Ee"] = "Ē",
    ["Oo"] = "Ō",
    ["Ou"] = "Ō",
    ["AA"] = "Ā",
    ["UU"] = "Ū",
    ["EE"] = "Ē",
    ["OO"] = "Ō",
    ["OU"] = "Ō"
}

local p = {}
--input: 1:1 transliterated romanji
function p.toHepburn(frame)
		local romanji = frame.args[1]
		for target, replacement in pairs(diacritics) do
        	romanji = romanji:gsub(target, replacement) 
    end
    return romanji	
end

return p