モジュール:cy-mut

出典: フリー多機能辞典『ウィクショナリー日本語版(Wiktionary)』
ナビゲーションに移動 検索に移動

このモジュールについての説明文ページを モジュール:cy-mut/doc に作成できます

local export = {}

function export.show(frame)
	PAGENAME = PAGENAME or mw.title.getCurrentTitle().text
	args = frame:getParent().args
	radical = args[1] or PAGENAME
	initial = mw.ustring.sub(radical,1,1)
	final = mw.ustring.sub(radical,2,-1)
	if mw.ustring.sub(radical,1,2)=='ll' or mw.ustring.sub(radical,1,2)=='Ll' or mw.ustring.sub(radical,1,2)=='rh' or mw.ustring.sub(radical,1,2)=='Rh' then
		initial = mw.ustring.sub(radical,1,2)
		final = mw.ustring.sub(radical,3,-1)
	end
	vowel = false
	if not mw.ustring.match(initial,'^[fhlnrsFHLNRS]$') then
		if mw.ustring.match(initial,'[aâeêiîoôuûwŵyŷ]') then
			vowel = true
			mut3 = "h" .. initial
		elseif mw.ustring.match(initial,'[AÂEÊIÎOÔUÛWŴYŶ]') then
			vowel = true
			mut3 = "H" .. mw.ustring.lower(initial)
		elseif initial == 'b' then
			mut1 = "f"
			mut2 = "m"
		elseif initial == 'B' then
			mut1 = "F"
			mut2 = "M"
		elseif initial == 'c' then
			mut1 = "g"
			mut2 = "ngh"
			mut3 = "ch"
		elseif initial == 'C' then
			mut1 = "G"
			mut2 = "Ngh"
			mut3 = "Ch"
		elseif initial == 'd' then
			mut1 = "dd"
			mut2 = "n"
		elseif initial == 'D' then
			mut1 = "Dd"
			mut2 = "N"
		elseif initial == 'g' then
			mut1 = ""
			mut2 = "ng"
		elseif initial == 'G' then
			mut1 = ""
			mut2 = "Ng"
		elseif initial == 'll' then
			mut1 = "l"
		elseif initial == 'Ll' then
			mut1 = "L"
		elseif initial == 'm' then
			mut1 = "f"
		elseif initial == 'M' then
			mut1 = "F"
		elseif initial == 'p' then
			mut1 = "b"
			mut2 = "mh"
			mut3 = "ph"
		elseif initial == 'P' then
			mut1 = "B"
			mut2 = "Mh"
			mut3 = "Ph"
		elseif initial == 'rh' then
			mut1 = "r"
		elseif initial == 'Rh' then
			mut1 = "R"
		elseif initial == 't' then
			mut1 = "d"
			mut2 = "nh"
			mut3 = "th"
		elseif initial == 'T' then
			mut1 = "D"
			mut2 = "Nh"
			mut3 = "Th"
		else
			error('この語には規則が指定されていません:'..radical)
		end
	end
	if not mut1 then mut1 = "変化なし" else
		mut1 = mut1 .. final
		if initial == "G" then mut1 = mw.ustring.upper(mw.ustring.sub(mut1,1,1)) .. mw.ustring.sub(mut1,2,-1) end
		mut1 = (mut1 == PAGENAME and "'''"..mut1.."'''" or '<span class="form-of soft-form-of lang-cy origin-'..radical..'">[['..mut1..'#ウェールズ語|'..mut1..']]</span>')
	end
	if not mut2 then mut2 = "変化なし" else
		mut2 = mut2 .. final
		mut2 = (mut2 == PAGENAME and "'''"..mut2.."'''" or '<span class="form-of nasal-form-of lang-cy origin-'..radical..'">[['..mut2..'#ウェールズ語|'..mut2..']]</span>')
	end
	if not mut3 then mut3 = "変化なし" else
		mut3 = mut3 .. final
		mut3 = (mut3 == PAGENAME and "'''"..mut3.."'''" or '<span class="form-of '..(vowel and 'h-prothesis' or 'aspirate')..'-form-of lang-cy origin-'..radical..'">[['..mut3..'#Welsh|'..mut3..']]</span>')
	end
	radical = radical == PAGENAME and "'''"..radical.."'''" or '[['..radical..'#ウェールズ語|'..radical..']]'
	result = '{| border="1" cellpadding="4" cellspacing="0" class="inflection-table" style="align: left; margin: 0.5em 0 0 0; border-style: solid; border: 1px solid #7f7f7f; border-right-width: 2px; border-bottom-width: 2px; border-collapse: collapse; background-color: #F8F8F8; font-size: 95%;"'
	result = result .. '\n|-'
	result = result .. '\n! colspan=4 | ウェールズ語の[[緩音現象]]'
	result = result .. '\n|-'
	result = result .. '\n! [[語根]] !! [[軟音化]] !! [[鼻音化]] !! ' .. (vowel and '[[h音添加]]' or '[[帯気音化]]')
	result = result .. '\n|-'
	result = result .. '\n| ' .. radical
	result = result .. '\n| ' .. mut1
	result = result .. '\n| ' .. mut2
	result = result .. '\n| ' .. mut3
	result = result .. '\n|-'
	result = result .. "\n| colspan=4 | <small style=\"font-size:85%;\">メモ:これは仮定に基づいたものである可能性があり、全ての変化が実際に起こるとは限らない。</small>"
	result = result .. '\n|}'
	return result
end

return export