2,788
edits
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
[1] = {alias_of = "r"}, | [1] = {alias_of = "r"}, | ||
r = {default = mw.title.getCurrentTitle().text}, | r = {default = mw.title.getCurrentTitle().text}, | ||
i = {}, | |||
initial = {alias_of = "i"}, | |||
s = {}, | s = {}, | ||
soft = {alias_of = "s"}, | |||
lenited = {alias_of = "s"}, | |||
nocat = {type = "boolean"}, | nocat = {type = "boolean"}, | ||
} | } | ||
Line 12: | Line 15: | ||
local UNCHANGED_MARKER = "<i>unchanged</i>" | local UNCHANGED_MARKER = "<i>unchanged</i>" | ||
local | local lenition = { | ||
["b"] = | ["b"] = "v", | ||
["k"] = "g", | |||
["k"] = | ["h"] = "", | ||
["h"] = | ["d"] = "ð", | ||
["d"] = | ["ð"] = "r", | ||
["f"] = "h", | |||
["ð"] = | ["g"] = "ŗ", | ||
["f"] = | ["ŗ"] = "", | ||
["g"] = | ["p"] = "b", | ||
["ŗ"] = | ["s"] = "r", | ||
["t"] = "d", | |||
["þ"] = "h", | |||
["p"] = | |||
[" | |||
["t"] = | |||
[" | |||
} | } | ||
local function get_radical_data(term) | local function get_radical_data(term, initial_override) | ||
local initial | local initial, remainder | ||
initial = mw.ustring.sub(term, 1, 1) | initial = initial_override or mw.ustring.sub(term, 1, 1) | ||
remainder = mw.ustring.sub(term, 2) | remainder = mw.ustring.sub(term, 2) | ||
return initial, remainder | |||
return initial | |||
end | end | ||
local function mutate_soft(data) | local function mutate_soft(data) | ||
local change = lenition[data.initial] | |||
local change = | |||
if change then | if change then | ||
return change .. data.remainder | return change .. data.remainder | ||
end | end | ||
return data.radical | return data.radical | ||
end | end | ||
function export.mutate(term) | function export.mutate(term, intial_override) | ||
local data = {} | local data = {} | ||
data.radical = term | data.radical = term | ||
data.initial | data.initial, data.remainder = get_radical_data(term, initial_override) | ||
data.soft = mutate_soft(data) | data.soft = mutate_soft(data) | ||
return data | return data | ||
end | end | ||
Line 102: | Line 63: | ||
local args = require("Module:parameters").process(frame:getParent().args, params) | local args = require("Module:parameters").process(frame:getParent().args, params) | ||
local radical = args["r"] | local radical = args["r"] | ||
local data = export.mutate(radical) | local data = export.mutate(radical, args["i"]) | ||
local s_mut, s_changed, s_irregular = get_mutation_info(radical, args["s"], data.soft) | local s_mut, s_changed, s_irregular = get_mutation_info(radical, args["s"], data.soft) | ||
local ret = '{| style="display:table; width:54%; border: 1px solid #b3b3b3; font-size: 95%; text-align: center;' | local ret = '{| style="display:table; width:54%; border: 1px solid #b3b3b3; font-size: 95%; text-align: center;' | ||
ret = ret .. '\n|-' | ret = ret .. '\n|-' | ||
ret = ret .. '\n! style="background:#efefef" colspan= | ret = ret .. '\n! style="background:#efefef" colspan=2 | [[Appendix:Riyan mutation|Riyan mutation]]' | ||
ret = ret .. '\n|-' | ret = ret .. '\n|-' | ||
ret = ret .. '\n! style="padding-top:4px;" | [[Appendix:Glossary#radical|radical]]' | ret = ret .. '\n! style="padding-top:4px;" | [[Appendix:Glossary#radical|radical]]' | ||
ret = ret .. '\n! style="padding-top:4px; | [[Appendix:Glossary#lenition|lenited]]' | ret = ret .. '\n! style="padding-top:4px; | [[Appendix:Glossary#lenition|lenited]]' | ||
ret = ret .. '\n|-' | ret = ret .. '\n|-' | ||
ret = ret .. '\n| style="padding-bottom:4px;" | ' .. radical | ret = ret .. '\n| style="padding-bottom:4px;" | ' .. radical | ||
ret = ret .. '\n| style="padding-bottom:4px;" | ' .. (s_changed and s_mut or UNCHANGED_MARKER) .. (s_irregular and IRREG_MARKER or "") | ret = ret .. '\n| style="padding-bottom:4px;" | ' .. (s_changed and s_mut or UNCHANGED_MARKER) .. (s_irregular and IRREG_MARKER or "") | ||
ret = ret .. '\n|-' | ret = ret .. '\n|-' | ||
if s_irregular | if s_irregular then | ||
ret = ret .. '\n| colspan= | ret = ret .. '\n| colspan=2 | <small style="font-size:85%;">' .. IRREG_MARKER .. 'Irregular.</small>' | ||
end | end | ||
if s_changed | if s_changed then | ||
ret = ret .. "\n| colspan= | ret = ret .. "\n| colspan=2 | <small style=\"font-size:85%;\">''Note:'' Some of these forms may be hypothetical. Not every possible mutated form of every word actually occurs.</small>" | ||
end | end | ||
ret = ret .. '\n|}' | ret = ret .. '\n|}' | ||
if | if s_irregular and (not args["nocat"]) then | ||
ret = ret .. "[[Categories:Riyan terms with irregular mutation]]" | ret = ret .. "[[Categories:Riyan terms with irregular mutation]]" | ||
end | end |