Module:snon-mut: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| (6 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
local | local m_links = require("Module:links") | ||
local | local lang = require("Module:languages").getByCode("snon") | ||
local | local export = {} | ||
function | local function repl(forms, param) | ||
if param ~= "normal" and forms[param] == forms["normal"] then | |||
return "''not applicable''" | |||
end | end | ||
local ret = m_links.full_link({lang = lang, term = forms[param]}) | |||
return | return ret | ||
end | end | ||
function export. | local table_cons = [=[ | ||
! radical | |||
! lenition | |||
! eclipsis | |||
|- | |||
| {{{normal}}} | |||
| {{{len}}} | |||
| {{{ecl}}} | |||
]=] | |||
local table_vowel = [=[ | |||
! radical !! eclipsis !! with ''h''-prothesis | |||
|- | |||
| {{{normal}}} | |||
| {{{ecl}}} | |||
| {{{hpro}}} | |||
]=] | |||
function export.mut(frame) | |||
local params = { | local params = { | ||
[1] = {}, | [1] = {}, | ||
[" | } | ||
[" | |||
[" | local args = require("Module:parameters").process(frame:getParent().args, params) | ||
local title = mw.loadData("Module:headword/data").pagename | |||
local forms = require("Module:snon-common").mutations(title, args[1]) | |||
local wikicode = mw.ustring.find(mw.ustring.lower(title), "^[aeiouàèìòù]") and table_vowel or table_cons | |||
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 = 'blue' | |||
} | |||
} | |||
result = result .. '\n' | |||
result = result .. mw.ustring.gsub(wikicode, "{{{([a-z0-9_]+)}}}", function(param) return repl(forms, param) end) | |||
result = result .. frame:expandTemplate{ | |||
title = 'inflection-table-bottom', | |||
args = { | |||
notes = '<p style="font-size:85%;"><i>Note:</i> Certain mutated forms of some words can never occur in standard Modern Scots Norse.<br>All possible mutated forms are displayed for convenience.</p>' | |||
} | |||
} | } | ||
return result | return result | ||
end | end | ||
return export | return export | ||
Latest revision as of 02:26, 23 April 2026
Documentation for this module may be created at Module:snon-mut/doc
local m_links = require("Module:links")
local lang = require("Module:languages").getByCode("snon")
local export = {}
local function repl(forms, param)
if param ~= "normal" and forms[param] == forms["normal"] then
return "''not applicable''"
end
local ret = m_links.full_link({lang = lang, term = forms[param]})
return ret
end
local table_cons = [=[
! radical
! lenition
! eclipsis
|-
| {{{normal}}}
| {{{len}}}
| {{{ecl}}}
]=]
local table_vowel = [=[
! radical !! eclipsis !! with ''h''-prothesis
|-
| {{{normal}}}
| {{{ecl}}}
| {{{hpro}}}
]=]
function export.mut(frame)
local params = {
[1] = {},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local title = mw.loadData("Module:headword/data").pagename
local forms = require("Module:snon-common").mutations(title, args[1])
local wikicode = mw.ustring.find(mw.ustring.lower(title), "^[aeiouàèìòù]") and table_vowel or table_cons
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 = 'blue'
}
}
result = result .. '\n'
result = result .. mw.ustring.gsub(wikicode, "{{{([a-z0-9_]+)}}}", function(param) return repl(forms, param) end)
result = result .. frame:expandTemplate{
title = 'inflection-table-bottom',
args = {
notes = '<p style="font-size:85%;"><i>Note:</i> Certain mutated forms of some words can never occur in standard Modern Scots Norse.<br>All possible mutated forms are displayed for convenience.</p>'
}
}
return result
end
return export