Module:Sandbox/Erutuon
< Module:Sandbox
Jump to navigation
Jump to search
Revision as of 21:30, 19 May 2019 by blackwiki>Erutuon (function for processing Proto-Slavic to remove unnecessary piping in Template:wt)
Lua error at line 30: attempt to index local 'content' (a nil value).
Lua error in Module:Sandbox/Erutuon/testcases at line 93: attempt to call upvalue 'parse_IETF' (a nil value).
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