-- Erzeugt eine Form eines Strings ohne Makron für Links in Flexionstabellen
local m = {}
function m.convert(frame)
if (frame.args.spr == "la") then
return noMacron(frame.args[1])
end
if (frame.args.spr == "ru") then
return noStress(frame.args[1])
end
return frame.args[1]
end
function noMacron(str)
local newstr = ""
local newcp = 0
local cp = 0
local from = "ĀāĒēĪīŌōŪūȲȳ"
local frto = "AaEeIiOoUuYy"
for cp in mw.ustring.gcodepoint(str) do
newcp = cp
for idx = 1, mw.ustring.len( from ) do
if (cp == mw.ustring.codepoint( from, idx)) then
newcp = mw.ustring.codepoint( frto, idx)
end
end
newstr = newstr .. mw.ustring.char(newcp)
end
return newstr
end
function noStress(str)
local stress = mw.ustring.char(0x0301)
local newstr = mw.ustring.gsub(str, stress, "")
return newstr
end
return m