Module:Sandbox/Erutuon
Appearance
local p = {}
local function make_entry_name(word)
for k, v in pairs {
["[ÀÁÃĀȀȂ]"] = "A",
["[àáãāȁȃ]"] = "a",
["[ÈÉẼĒȄȆ]"] = "E",
["[èéẽēȅȇ]"] = "e",
["[ÌÍĨĪȈȊ]"] = "I",
["[ìíĩīȉȋ]"] = "i",
["[ÒÓÕŌȌȎŐ]"] = "O",
["[òóõōȍȏő]"] = "o",
["[ÙÚŨŪȔȖŰ]"] = "U",
["[ùúũūȕȗű]"] = "u",
["[ỲÝỸȲ]"] = "Y",
["[ỳýỹȳ]"] = "y",
["Ǭ"] = "Ǫ",
["ǭ"] = "ǫ",
["[̀́̃̄̏̑]"]= "",
["ĭ"] = "ь",
["ŭ"] = "ъ",
} do
word = mw.ustring.gsub(word, k, v)
end
return word
end
function p.show(frame)
local content = mw.title.new "Proto-Slavic":getContent()
local new_content = content:gsub(
'{{wt|sla%-pro|([^|}]+)|([^|}]+)}}',
function (entry, text)
if make_entry_name(text) == entry then
return '{{wt|sla-pro|' .. text .. '}}'
else
mw.log(entry, text)
end
end)
if content ~= new_content then
return frame:extensionTag{
name = "syntaxhighlight",
content = new_content,
args = { lang = "lua" },
}
end
end
return p