Module:mg-spel: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 6: Line 6:
local m_l = require('Module:links')
local m_l = require('Module:links')
local m_q = require('Module:qualifier')
local m_q = require('Module:qualifier')
local abbr = {"Spanish", "Asturian", "Celtic", "Southern"}


local export = {}
local export = {}
Line 80: Line 78:
end
end


function export.mutate(frame)
local term = frame:getParent().args[1] or PAGENAME
local unchanged = "''unchanged''"
local spat = {["p"] = "b", ["b"] = "v", ["t"] = "d", ["d"] = "z", ["c"] = "g", ["q"] = "g", ["g"] = "h"}
local npat = {["m"] = "v", ["b"] = "m", ["d"] = "n", ["g"] = "k"}
local function aw(term, mutation)
local mutated = nil
for regex, repl in pairs(mutation == "nasal" and npat or spat) do
mutated = gsub(term, "^" .. regex, repl, 1)
mutated = gsub(mutated, "^k(.)", function(foo) return match(foo, "[aou]") and "c" or "qu" end)
if mutated ~= word then return mutated end
end
mutated = gsub(mutated, "^k(.)", function(foo) return match(foo, "[aou]") and "c" or "qu" end)
return not mutated and unchanged
end
local function link(term)
local links = {}
for alt in gmatch(term, "([^%s,]+)") do
alt = "[[Contionary:" .. alt .. "|" .. alt .. "]]"
table.insert(links, alt)
end
return table.concat(links, ", ")
end
local reference = "<ref>Christian Evans, (2021). <span class="plainlinks">[https://drive.google.com/file/d/1AIZ_FwLek3nKrYsbE9sZxTZmi_pwf7DR “Mutation in Modern Gallaecian”]</span>, ''Segments'' (01-07), April 2021.</ref>"
local wikicode = [=[
{| border="1" cellpadding="4" cellspacing="0" class="inflection-table" style="text-align: center; margin: 0.5em 0 0 0; border-style: solid; border: 1px solid #7f7f7f; border-right-width: 2px; border-bottom-width: 2px; border-collapse: collapse; background-color: #F8F8F8; font-size: 95%;"
|-
! colspan="3" | [[Modern Gallaecian mutation]]]=] .. reference .. [=[
|-
! Radical
! Soft
! Hard
|-
| ]=] .. term .. [=[
| ]=] .. aw(term, "soft") .. [=[
| ]=] .. aw(term, "nasal") .. [=[
|-
| colspan=3 style="font-size: 89%; text-align: left;" | <references />
|}
]=]
return wikicode
end


return export
return export