Module:snon-mut: Difference between revisions

Melinoë (talk | contribs)
No edit summary
Tag: Reverted
Melinoë (talk | contribs)
No edit summary
 
(26 intermediate revisions by the same user not shown)
Line 10: Line 10:


local GRAVE = "\204\128"
local GRAVE = "\204\128"
local ACUTE = "\204\129"
local CIRC = "\204\130"
local DIAER = "\204\136"


local lang = require("Module:languages").getByCode("cy")
local lang = require("Module:languages").getByCode("snon")
local PAGENAME = mw.loadData("Module:headword/data").pagename
local PAGENAME = mw.loadData("Module:headword/data").pagename
local MARKER = "<sup>△</sup>"
local MARKER = "<sup>△</sup>"


local mutation_rules = {
local mutation_rules = {
["b"] = {"bb", "m", "bh"},
["b"] = {"b", "m", "bh"},
["bh"] = {"b", "m", "gh"},
["c"] = {"g", "ngh", "ch"},
["c"] = {"g", "ngh", "ch"},
["ch"] = {"gh", "ngh"},
["d"] = {"d", "n", "dh"},
["d"] = {"dd", "n", "dh"},
["g"] = {"g", "ng", "gh"},
["dh"] = {"d", "n", "gh"},
["h"] = {"gh", "nh", "'"},
["g"] = {"gg", "ng", "gh"},
["l"] = {"l", "l", "lh"},
["h"] = {"gh", "nh", "ch"},
["m"] = {"b", "m", "mh"},
["l"] = {"lh"},
["n"] = {"d", "n", "nh"},
["m"] = {"mh"},
["n"] = {"nh"},
["p"] = {"b", "mh", "ph"},
["p"] = {"b", "mh", "ph"},
["ph"] = {"bh", "mh", "h"},
["f"] = {"v", "mh", "fh"},
["r"] = {"rr", "rh"},
["v"] = {"b", "m", "vh"},
["s"] = {"z", "sh"},
["r"] = {"r", "r", "rh"},
["s"] = {"z", "nh","sh"},
["t"] = {"d", "nh", "th"},
["t"] = {"d", "nh", "th"},
["th"] = {"dh", "nh", "h"},
}
}


Line 44: Line 38:
data.is_uppercase = term_lower ~= term
data.is_uppercase = term_lower ~= term
local normalized = toNFD(term_lower)
local normalized = toNFD(term_lower)
data.vowel = normalized:match("^[aeiouwy]") and true or false
data.vowel = normalized:match("^[aeiou]") and true or false
if data.vowel then
if data.vowel then
data.mut3 = "h"
data.final = term_lower
if not (normalized:match("^i[aeiou]")) then
data.mut1 = "gh-"
data.mut2 = "n-"
data.mut3 = "h-"
end
return data
return data
end
end
Line 110: Line 109:
local params = {
local params = {
[1] = {},
[1] = {},
["soft"] = {},
["voiced"] = {},
["nasal"] = {},
["nasal"] = {},
["aspirate"] = {},
["aspirate"] = {},
Line 121: Line 120:
local data = export.get_mutation_data(title)
local data = export.get_mutation_data(title)


local soft, has_soft, has_irreg_soft = construct_mutation(data, "soft", data.mut1, args.soft)
local voiced, has_voiced, has_irreg_voiced = construct_mutation(data, data.vowel and "gh-prothesis" or "voiced", data.mut1, args.voiced)
local nasal, has_nasal, has_irreg_nasal  = construct_mutation(data, "nasal", data.mut2, args.nasal)
local nasal, has_nasal, has_irreg_nasal  = construct_mutation(data, data.vowel and "n-prothesis" or "nasal", data.mut2, args.nasal)
local aspirate, has_aspirate, has_irreg_aspirate = construct_mutation(data, data.vowel and "h-prothesis" or "aspirate", data.mut3, args.aspirate)
local aspirate, has_aspirate, has_irreg_aspirate = construct_mutation(data, data.vowel and "h-prothesis" or "aspirate", data.mut3, args.aspirate)


local result = frame:expandTemplate{ title = 'inflection-table-top',  
local result = frame:expandTemplate{ title = 'inflection-table-top',  
args = { title = '[[Appendix:Scots Norse mutations|Mutated forms]] of ' .. require("Module:links").full_link({lang = lang, alt = title}, 'term'), palette = 'green' } }
args = { title = '[[Appendix:Scots Norse mutations|Mutated forms]] of ' .. require("Module:links").full_link({lang = lang, alt = title}, 'term'), palette = 'blue' } }
result = result .. '\n! [[radical]]'
result = result .. '\n! [[radical]]'
result = result .. '\n! ' .. (data.vowel and 'gh-prothesis' or '[[soft mutation|voiced]]')
result = result .. '\n! ' .. (data.vowel and 'gh-prothesis' or '[[soft mutation|voiced]]')
result = result .. '\n! ' .. (data.vowel and 'nh-prothesis' or '[[nasal mutation|nasal]]')
result = result .. '\n! ' .. (data.vowel and 'n-prothesis' or '[[nasal mutation|nasal]]')
result = result .. '\n! ' .. (data.vowel and 'h-prothesis' or '[[aspirate mutation|aspirate]]')
result = result .. '\n! ' .. (data.vowel and 'h-prothesis' or '[[aspirate mutation|aspirate]]')
result = result .. '\n|-'
result = result .. '\n|-'
result = result .. '\n| ' .. require("Module:links").full_link({lang = lang, term = data.radical})
result = result .. '\n| ' .. require("Module:links").full_link({lang = lang, term = data.radical})
result = result .. '\n| ' .. soft
result = result .. '\n| ' .. voiced
result = result .. '\n| ' .. nasal
result = result .. '\n| ' .. nasal
result = result .. '\n| ' .. aspirate
result = result .. '\n| ' .. aspirate
notes = ''
notes = ''
if has_irreg_soft or has_irreg_nasal or has_irreg_aspirate then
if has_irreg_voiced or has_irreg_nasal or has_irreg_aspirate then
notes = notes .. '<p style="font-size:85%;">' .. MARKER .. 'Irregular.</p>'
notes = notes .. '<p style="font-size:85%;">' .. MARKER .. 'Irregular.</p>'
end
end
if has_soft or has_nasal or has_aspirate then
if has_voiced or has_nasal or has_aspirate then
notes = notes .. '<p style="font-size:85%;"><i>Note:</i> Certain mutated forms of some words can never occur in standard Scots Norse.<br>All possible mutated forms are displayed for convenience.</p>'
notes = notes .. '<p style="font-size:85%;"><i>Note:</i> Certain mutated forms of some words can never occur in standard Scots Norse.<br>All possible mutated forms are displayed for convenience.</p>'
end
end
result = result .. '\n' .. frame:expandTemplate{ title = 'inflection-table-bottom', args = { notes = notes } }
result = result .. '\n' .. frame:expandTemplate{ title = 'inflection-table-bottom', args = { notes = notes } }
if not args.nocat and (has_irreg_soft or has_irreg_nasal or has_irreg_aspirate) then
if not args.nocat and (has_irreg_voiced or has_irreg_nasal or has_irreg_aspirate) then
result = result .. require("Module:utilities").format_categories("Welsh terms with irregular mutation", lang)
result = result .. require("Module:utilities").format_categories("Scots Norse terms with irregular mutation", lang)
end
end
return result
return result