Module:snon-mut: Difference between revisions
No edit summary |
No edit summary |
||
| (29 intermediate revisions by the same user not shown) | |||
| Line 10: | Line 10: | ||
local GRAVE = "\204\128" | local GRAVE = "\204\128" | ||
local lang = require("Module:languages").getByCode(" | 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"] = {" | ["b"] = {"b", "m", "bh"}, | ||
["c"] = {"g", "ngh", "ch"}, | ["c"] = {"g", "ngh", "ch"}, | ||
[" | ["d"] = {"d", "n", "dh"}, | ||
["g"] = {"g", "ng", "gh"}, | |||
[" | ["h"] = {"gh", "nh", "'"}, | ||
[" | ["l"] = {"l", "l", "lh"}, | ||
[" | ["m"] = {"b", "m", "mh"}, | ||
[" | ["n"] = {"d", "n", "nh"}, | ||
["n"] = {"nh"}, | |||
["p"] = {"b", "mh", "ph"}, | ["p"] = {"b", "mh", "ph"}, | ||
[" | ["f"] = {"v", "mh", "fh"}, | ||
["r"] = {" | ["v"] = {"b", "m", "vh"}, | ||
["s"] = {"z", "sh"}, | ["r"] = {"r", "r", "rh"}, | ||
["s"] = {"z", "nh","sh"}, | |||
["t"] = {"d", "nh", "th"}, | ["t"] = {"d", "nh", "th"}, | ||
} | } | ||
| 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("^[ | data.vowel = normalized:match("^[aeiou]") and true or false | ||
if data.vowel then | if data.vowel then | ||
data.final = term_lower | data.final = term_lower | ||
data.mut3 = "h" | if not (normalized:match("^i[aeiou]")) then | ||
data.mut1 = "gh-" | |||
data.mut2 = "n-" | |||
data.mut3 = "h-" | |||
end | |||
return data | return data | ||
end | end | ||
| Line 71: | Line 69: | ||
end | end | ||
data.colloquial = mut.colloquial | data.colloquial = mut.colloquial | ||
end | end | ||
| Line 124: | Line 109: | ||
local params = { | local params = { | ||
[1] = {}, | [1] = {}, | ||
[" | ["voiced"] = {}, | ||
["nasal"] = {}, | ["nasal"] = {}, | ||
["aspirate"] = {}, | ["aspirate"] = {}, | ||
| Line 135: | Line 120: | ||
local data = export.get_mutation_data(title) | local data = export.get_mutation_data(title) | ||
local | 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 = ' | 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! [[soft mutation|voiced]]' | result = result .. '\n! ' .. (data.vowel and 'gh-prothesis' or '[[soft mutation|voiced]]') | ||
result = result .. '\n! [[nasal mutation|nasal]]' | result = result .. '\n! ' .. (data.vowel and 'n-prothesis' or '[[nasal mutation|nasal]]') | ||
result = result .. '\n! ' .. (data.vowel and ' | 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| ' .. | result = result .. '\n| ' .. voiced | ||
result = result .. '\n| ' .. nasal | result = result .. '\n| ' .. nasal | ||
result = result .. '\n| ' .. aspirate | result = result .. '\n| ' .. aspirate | ||
notes = '' | notes = '' | ||
if | 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 | 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 ( | if not args.nocat and (has_irreg_voiced or has_irreg_nasal or has_irreg_aspirate) then | ||
result = result .. require("Module:utilities").format_categories(" | result = result .. require("Module:utilities").format_categories("Scots Norse terms with irregular mutation", lang) | ||
end | end | ||
return result | return result | ||