Module:snon-mut: Difference between revisions
No edit summary |
No edit summary |
||
| (13 intermediate revisions by 2 users not shown) | |||
| Line 11: | Line 11: | ||
local export = {} | local export = {} | ||
function export.mutations(ret, args) | function export.mutations(ret, args) | ||
| Line 35: | Line 25: | ||
ret.lenition = ret.radical:gsub("^(.)", "%1h") | ret.lenition = ret.radical:gsub("^(.)", "%1h") | ||
elseif match(first_letter, vowels) then -- h-prothesis | elseif match(first_letter, vowels) then -- h-prothesis | ||
ret.lenition = "h'" .. | ret.lenition = "h'" .. lower_radical | ||
apostrophe = true | apostrophe = true | ||
elseif match(lower_radical, "^ghi" .. vowels) then | elseif match(lower_radical, "^ghi" .. vowels) then | ||
| Line 45: | Line 35: | ||
local eclipsis_prefixes = { | local eclipsis_prefixes = { | ||
["b"] = "m", ["c"] = "g", ["d"] = "n", ["f"] = "v", ["g"] = "n", | ["b"] = "m", ["c"] = "g", ["d"] = "n", ["f"] = "v", ["g"] = "n", | ||
["p"] = "b", ["t"] = "d", ["h"] = " | ["p"] = "b", ["t"] = "d", ["h"] = "gh", ["s"] = "z", ["v"] = "b", | ||
} | } | ||
| Line 53: | Line 43: | ||
ret.eclipsis = eclipsis_prefixes[first_letter] .. sub(lower_radical, 2, -1) | ret.eclipsis = eclipsis_prefixes[first_letter] .. sub(lower_radical, 2, -1) | ||
elseif match(first_letter, vowels) then | elseif match(first_letter, vowels) then | ||
ret.eclipsis = "n'" .. | ret.eclipsis = "n'" .. lower_radical | ||
apostrophe = true | apostrophe = true | ||
elseif match(lower_radical, "^ghi" .. vowels) then | elseif match(lower_radical, "^ghi" .. vowels) then | ||
| Line 63: | Line 53: | ||
if is_proper then | if is_proper then | ||
if apostrophe then | if apostrophe then | ||
ret.eclipsis = ret.eclipsis | ret.eclipsis = "n" .. gsub(ret.eclipsis, "^n'(%w)", upper) | ||
ret.lenition = ret.lenition | ret.lenition = "h" .. gsub(ret.lenition, "^h'(%w)", upper) | ||
else | else | ||
ret.eclipsis = ret.eclipsis | ret.eclipsis = gsub(ret.eclipsis, "^(%w)", upper) | ||
ret.lenition = ret.lenition | ret.lenition = gsub(ret.lenition, "^(%w)", upper) | ||
end | end | ||
end | end | ||
return ret | return ret, apostrophe | ||
end | end | ||
| Line 80: | Line 70: | ||
["ecl"] = {}, | ["ecl"] = {}, | ||
["len"] = {}, | ["len"] = {}, | ||
["temp_len"] = {type = "boolean"}, | |||
["temp_ecl"] = {type = "boolean"}, | |||
} | } | ||
local args = require("Module:parameters").process(frame:getParent().args, params) | local args = require("Module:parameters").process(frame:getParent().args, params) | ||
local is_vowel | |||
local ret = {radical = args[1]} | local ret = {radical = args[1]} | ||
ret = export.mutations(ret, args) | ret, is_vowel = export.mutations(ret, args) | ||
if args.temp_len then | |||
return ret.lenition == "-" and ret.radical or ret.lenition | |||
end | |||
if args.temp_ecl then | |||
return ret.eclipsis == "-" and ret.radical or ret.eclipsis | |||
end | |||
local links = {} | local links = {} | ||
for k, v in pairs(ret) do | for k, v in pairs(ret) do | ||
links[k] = m_l.full_link{lang = lang, term = v} | if v == "-" then | ||
links[k] = "''not applicable''" | |||
else | |||
links[k] = m_l.full_link{lang = lang, term = v} | |||
end | |||
end | end | ||
local table_args = { | local table_args = { | ||
palette = "blue", | palette = "blue", | ||
notes = "Certain mutated forms of some words can never occur in standard | notes = "<p style=font-size:85%;>''Note:'' Certain mutated forms of some words can never occur in standard Scots Norse.<br>All possible mutated forms are displayed for convenience.</p>", | ||
title = "[[Scots Norse#Mutation|Mutated forms]] of " .. ret.radical | title = "[[Scots Norse#Mutation|Mutated forms]] of " .. ret.radical, | ||
-- class = "wide", | |||
} | } | ||
local contents = [[ | local contents = [[ | ||
! radical !! lenition !! eclipsis | |- | ||
! radical !! ]] .. (is_vowel and "h-prothesis" or "lenition") .. [[ !! eclipsis | |||
|- | |- | ||
| {radical} || {lenition} || {eclipsis} | | {radical} || {lenition} || {eclipsis} | ||