MODULO
Memtesto ne disponeblas.
  • uzata en la ŝablono {{Flexlink}} kun ~1450 ligitaj paĝoj

local m = {}

function m.convert(frame)
  if (frame.args.spr ~= "la") then
    return frame.args[1]
  end
  return noMacron(frame.args[1])
end

function noMacron(str)
  local newstr = ""
  local newcp = 0
  local cp = 0
  local from = "ĀāĒēĪīŌōŪū"
  local frto = "AaEeIiOoUu"

  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

return m