Module:snon-mut: Difference between revisions

From Linguifex
Jump to navigation Jump to search
Melinoë (talk | contribs)
Created page with "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 ! nasal ! voiced |- | {{{normal}}} | {{{len}}} | {{{nas}}} | {{{voi}}} ]=] function expo..."
 
Melinoë (talk | contribs)
No edit summary
 
(38 intermediate revisions by the same user not shown)
Line 20: Line 20:
! radical
! radical
! lenition
! lenition
! nasal
! eclipsis
! voiced
|-
|-
| {{{normal}}}
| {{{normal}}}
| {{{len}}}
| {{{len}}}
| {{{nas}}}
| {{{ecl}}}
| {{{voi}}}
]=]
]=]
local table_vowel = [=[
! radical !! eclipsis !! with ''h''-prothesis
|-
| {{{normal}}}
| {{{ecl}}}
| {{{hpro}}}
]=]


function export.mut(frame)
function export.mut(frame)
Line 38: Line 46:
local title = mw.loadData("Module:headword/data").pagename
local title = mw.loadData("Module:headword/data").pagename
local forms = require("Module:snon-common").mutations(title, args[1])
local forms = require("Module:snon-common").mutations(title, args[1])
local wikicode = mw.ustring.find(mw.ustring.lower(title), "^[aeiouøyàèìòùø̀ỳ]") and table_vowel or table_cons
local wikicode = mw.ustring.find(mw.ustring.lower(title), "^[aeiouàèìòù]") and table_vowel or table_cons
local result = frame:expandTemplate{  
local result = frame:expandTemplate{  
title = 'inflection-table-top',  
title = 'inflection-table-top',  
args = {
args = {
title = '[[Scots Norse mutations|Mutated forms]] of ' .. require("Module:links").full_link({lang = lang, alt = title}, 'term'),
title = '[[Appendix:Scots Norse mutations|Mutated forms]] of ' .. require("Module:links").full_link({lang = lang, alt = title}, 'term'),
palette = 'green'
palette = 'blue'
}
}
}
}
Line 52: Line 60:
title = 'inflection-table-bottom',  
title = 'inflection-table-bottom',  
args = {
args = {
notes = '<p style="font-size:85%;"><i>Note:</i> Certain mutated forms of some words can never occur in standard Modern Irish.<br>All possible mutated forms are displayed for convenience.</p>'
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>'
}
}
}
}

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