Module:krv-script: Difference between revisions

Jump to navigation Jump to search
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
(Created page with "local export = {} local getArgs = require("Module:Arguments").getArgs local m_table = require("Module:table") local correspondences = { {"ẓ","ჟ"}, {"ṣ","შ"}, {"ṛ","ღ"}, {"ṇ","ჹ"}, {"ḥ","ხ"}, {"z","ზ"}, {"v","ვ"}, {"u","უ"}, {"th","თ"}, {"t","ტ"}, {"s","ს"}, {"r","რ"}, {"ph","ფ"}, {"p","პ"}, {"o","ო"}, {"n","ნ"}, {"m","მ"}, {"l","ლ"}, {"kh","ქ"}, {"k","კ"}, {"i","ი"}, {"h","ჰ"}, {"g","გ"}, {"...")
 
No edit summary
Line 38: Line 38:
{"b","ბ"},
{"b","ბ"},
{"a","ა"},
{"a","ა"},
}
local correspondences_old = {
{"θ","ⴇ"},
{"β","ⴁ"},
{"ɸ","ⴔ"},
{"ɣ","ⴖ"},
{"ž","ⴏ"},
{"š","ⴘ"},
{"ŋ","ⴂ"},
{"čh","ⴙ"},
{"č","ჩ"},
{"ð","ⴃ"},
{"z","ⴆ"},
{"x","ⴞ"},
{"w","ⴣ"},
{"u","ⴓ"},
{"th","ⴇ"},
{"t","ⴒ"},
{"s","ⴑ"},
{"r","ⴐ"},
{"ph","ⴔ"},
{"p","ⴎ"},
{"o","ⴍ"},
{"n","ⴌ"},
{"m","ⴋ"},
{"l","ⴊ"},
{"kh","ⴕ"},
{"k","ⴉ"},
{"j","ⴢ"},
{"i","ⴈ"},
{"h","ⴠ"},
{"g","ⴂ"},
{"e","ⴄ"},
{"dž","ⴟ"},
{"dz","ⴛ"},
{"d","ⴃ"},
{"ch","ⴚ"},
{"c","ⴜ"},
{"b","ⴁ"},
{"a","ⴀ"},
}
}


Line 46: Line 87:
     text = mw.ustring.gsub(text, "ō", "o")
     text = mw.ustring.gsub(text, "ō", "o")
     text = mw.ustring.gsub(text, "ū", "u")
     text = mw.ustring.gsub(text, "ū", "u")
    text = mw.ustring.gsub(text, "̄", "u")
     return text
     return text
end
end


function convert(text)
function convert(text, old)
local it = correspondences
if old then it = correspondences_old end
     text = mw.ustring.lower(text)
     text = mw.ustring.lower(text)
     text = demacron(text)
     text = demacron(text)
     for _, c in ipairs(correspondences) do
     for _, c in ipairs(it) do
     text = mw.ustring.gsub(text, c[1], c[2])
     text = mw.ustring.gsub(text, c[1], c[2])
     end
     end
Line 71: Line 115:
     end
     end
      
      
     local script = convert(text)
     local script = convert(text, parameters["old"] or false)
   
    local out = script
      
      
     if parameters["both"] then
     if parameters["both"] then
     local delim = args["delim"] or " · "
     local delim = args["delim"] or " · "
     if parameters["demacron"] then text = demacron(text) end
     if parameters["demacron"] then text = demacron(text) end
return script .. delim .. text
    out = out .. delim .. text
    end
 
if parameters["inline"] then
return demacron(text) .. "<alt:" .. out .. ">"
else
else
return script
return out
end
end
end
end
Line 86: Line 136:
--[[
--[[
Debug console test string:
Debug console test string:
=p.generate(mw.getCurrentFrame():newChild{title="whatever",args={"noun", "nom", "dv", "a^u", "n", "þ"}})
=p.show(mw.getCurrentFrame():newChild{title="whatever",args={"nēphas"}})
]]--
]]--

Navigation menu