Difference between revisions of "Module:Sandbox/Erutuon"
Jump to navigation
Jump to search
blackwiki>Pppery (Module:Table has been merged) |
blackwiki>Erutuon (function for processing Proto-Slavic to remove unnecessary piping in Template:wt) |
||
| Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
| − | local | + | 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 | end | ||
| + | return word | ||
end | end | ||
| − | function p. | + | function p.show(frame) |
| − | local | + | 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) | |
| − | |||
| − | |||
| − | local | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
end | end | ||
| − | + | end) | |
| − | + | if content ~= new_content then | |
| − | + | return frame:extensionTag{ | |
| − | + | name = "syntaxhighlight", | |
| − | + | content = new_content, | |
| − | end | + | args = { lang = "lua" }, |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
} | } | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
end | end | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
end | end | ||
return p | return p | ||
Revision as of 21:30, 19 May 2019
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