Pergi ke kandungan

Modul:ko-tone

Daripada Wikikamus
local p = {}

-- mw.ustring.gsub: replace text

local pagename = mw.title.getCurrentTitle().text
local templatestyles = require('Module:TemplateStyles')('Template:ko-tone/style.css')

local function tag(text, accent)
	return tostring(
		mw.html.create('span')
			:wikitext(text)
			:addClass('ko-acc-' .. accent)
		:done()
	)
end

local w_H = tag(pagename, 'H')

local w_L = pagename

local w_F = tag(pagename, 'F')

local w_R = tag(pagename, 'R')

local w_HL = mw.ustring.gsub(pagename, '^(.)', function(a)
	return tag(a, 'H')
end)

local w_LHH = mw.ustring.gsub(pagename, '^(.)(..?)', function(a, b)
	return a .. tag(b, 'H')
end)

local w_LFF = mw.ustring.gsub(pagename, '^(.)(..?)', function(a, b)
	return a .. tag(b, 'F')
end)

local w_HHL = mw.ustring.gsub(pagename, '^(..)', function(a)
	return tag(a, 'H')
end)

local w_LHL = mw.ustring.gsub(pagename, '^(.)(.)', function(a, b)
	return a .. tag(b, 'H')
end)

local w_LLH = mw.ustring.gsub(pagename, '^(..)(.)', function(a, b)
	return a .. tag(b, 'H')
end)

local w_LLF = mw.ustring.gsub(pagename, '^(..)(.)', function(a, b)
	return a .. tag(b, 'F')
end)

local w_LLLH = mw.ustring.gsub(pagename, '^(...)(.)', function(a, b)
	return a .. tag(b, 'H')
end)

function p.H(frame)
	return  '<b>[[w:Dialek Gyeongsang|Gyeongsang]] Selatan ([[Busan]]) [[aksen nada]]:</b> ',
			'<span style="font-size: 13pt;">',
			w_H .. '의 / ',
			w_H .. '에 / ',
			w_L .. tag('까', 'H') .. '지',
			'</span>',
			'<p style="font-size: 9pt; color:#505050"><i>Suku kata berwarna merah mengambil nada tinggi. This word takes low pitch only before consonant-initial multisyllabic suffixes.</i></p>',
			templatestyles
end

function p.H_H_reg(frame)
	return  '<b>[[w:Dialek Gyeongsang|Gyeongsang]] Selatan ([[Busan]]) [[aksen nada]]:</b> ',
			'<span style="font-size: 13pt;">',
			w_H .. tag('의', 'H') .. ' / ',
			w_H .. tag('에', 'H') .. ' / ',
			w_H .. tag('까', 'H') .. '지',
			'</span>',
			'<p style="font-size: 9pt; color:#505050"><i>Suku kata berwarna merah mengambil nada tinggi. This word always takes high pitch and also heightens the next suffixed syllable.</i></p>',
			templatestyles
end

function p.H_H_irreg(frame)
	return  '<b>[[w:Dialek Gyeongsang|Gyeongsang]] Selatan ([[Busan]]) [[aksen nada]]:</b> ',
			'<span style="font-size: 13pt;">',
			w_H .. tag('의', 'H') .. ' / ',
			w_H .. '에 / ',
			w_H .. tag('까', 'H') .. '지',
			'</span>',
			'<p style="font-size: 9pt; color:#505050"><i>Suku kata berwarna merah mengambil nada tinggi. This word always takes high pitch and also heightens the next suffixed syllable, unless it is 에.</i></p>',
			templatestyles
end

function p.F(frame)
	return  '<b>[[w:Dialek Gyeongsang|Gyeongsang]] Selatan ([[Busan]]) [[aksen nada]]:</b> ',
			'<span style="font-size: 13pt;">',
			w_F .. '의 / ',
			w_F .. '에 / ',
			w_F .. '까지',
			'</span>',
			'<p style="font-size: 9pt; color:#505050"><i>Suku kata berwarna ungu mengambil nada menurun, urutan [[morae|bimoraic]] nada tinggi ke rendah. This word always takes falling pitch, dan merendahkan nada akhiran berikutnya.</i></p>',
			templatestyles
end

function p.R(frame)
	return  '<b>[[w:Dialek Gyeongsang|Gyeongsang]] Selatan ([[Busan]]) [[aksen nada]]:</b> ',
			'<span style="font-size: 13pt;">',
			w_R .. '의 / ',
			w_R .. '에 / ',
			w_R .. '까지',
			'</span>',
			'<p style="font-size: 9pt; color:#505050"><i>Suku kata berwarna biru mengambil nada menaik, a [[morae|bimoraic]] sequence of low to high pitch. This word always takes rising pitch, dan merendahkan nada akhiran berikutnya.</i></p>',
			templatestyles
end

function p.L_reg(frame)
	return  '<b>[[w:Dialek Gyeongsang|Gyeongsang]] Selatan ([[Busan]]) [[aksen nada]]:</b> ',
			'<span style="font-size: 13pt;">',
			w_L .. tag('의', 'H') .. ' / ',
			w_L .. tag('에', 'H') .. ' / ',
			w_L .. tag('까지', 'H'),
			'</span>',
			'<p style="font-size: 9pt; color:#505050"><i>Suku kata berwarna merah mengambil nada tinggi. This word always takes low pitch, and heightens the pitch of two subsequent suffixed syllables.</i></p>',
			templatestyles
end

function p.HH(frame)
	return  '<b>[[w:Dialek Gyeongsang|Gyeongsang]] Selatan ([[Busan]]) [[aksen nada]]:</b> ',
			'<span style="font-size: 13pt;">',
			w_H .. '의 / ',
			w_H .. '에 / ',
			w_H .. '까지',
			'</span>',
			'<p style="font-size: 9pt; color:#505050"><i>Syllables in red take high pitch. This word always takes high pitch on both syllables, dan merendahkan nada akhiran berikutnya.</i></p>',
			templatestyles
end

function p.HL(frame)
	return  '<b>[[w:Dialek Gyeongsang|Gyeongsang]] Selatan ([[Busan]]) [[aksen nada]]:</b> ',
			'<span style="font-size: 13pt;">',
			w_HL .. '의 / ',
			w_HL .. '에 / ',
			w_HL .. '까지',
			'</span>',
			'<p style="font-size: 9pt; color:#505050"><i>Suku kata berwarna merah mengambil nada tinggi. Perkataan ini selalu mengambil nada tinggi sahaja pada suku kata pertama, dan merendahkan nada akhiran berikutnya.</i></p>',
			templatestyles
end

function p.LH_reg(frame)
	return  '<b>[[w:Dialek Gyeongsang|Gyeongsang]] Selatan ([[Busan]]) [[aksen nada]]:</b> ',
			'<span style="font-size: 13pt;">',
			w_LHH .. '의 / ',
			w_LHH .. '에 / ',
			w_L .. tag('까', 'H') .. '지',
			'</span>',
			'<p style="font-size: 9pt; color:#505050"><i>Syllables in red take high pitch. This word always takes high pitch only on the second syllable, except before consonant-initial multisyllabic suffixes, apabila ia mengambil nada rendah penuh.</i></p>',
			templatestyles
end

function p.LH_H(frame)
	return  '<b>[[w:Dialek Gyeongsang|Gyeongsang]] Selatan ([[Busan]]) [[aksen nada]]:</b> ',
			'<span style="font-size: 13pt;">',
			w_LHH .. tag('의', 'H') .. ' / ',
			w_LHH .. tag('에', 'H') .. ' / ',
			w_LHH .. tag('까', 'H') .. '지',
			'</span>',
			'<p style="font-size: 9pt; color:#505050"><i>Syllables in red take high pitch. This word always takes high pitch only on the second syllable, and also heightens the subsequent suffixed syllable.</i></p>',
			templatestyles
end

function p.LF(frame)
	return  '<b>[[w:Dialek Gyeongsang|Gyeongsang]] Selatan ([[Busan]]) [[aksen nada]]:</b> ',
			'<span style="font-size: 13pt;">',
			w_LFF .. '의 / ',
			w_LFF .. '에 / ',
			w_LFF .. '까지',
			'</span>',
			'<p style="font-size: 9pt; color:#505050"><i>Syllables in purple take falling pitch, a [[morae|bimoraic]] sequence of high to low pitch. This word always takes falling pitch on the second and third syllables, dan merendahkan nada akhiran berikutnya.</i></p>',
			templatestyles
end

function p.HHL(frame)
	return  '<b>[[w:Dialek Gyeongsang|Gyeongsang]] Selatan ([[Busan]]) [[aksen nada]]:</b> ',
			'<span style="font-size: 13pt;">',
			w_HHL .. '의 / ',
			w_HHL .. '에 / ',
			w_HHL .. '까지',
			'</span>',
			'<p style="font-size: 9pt; color:#505050"><i>Suku kata berwarna merah mengambil nada tinggi. Perkataan ini selalunya mengambil nada tinggi pada dua suku kata pertama, dan merendahkan nada akhiran berikutnya.</i></p>',
			templatestyles
end

function p.HLL(frame)
	return  '<b>[[w:Dialek Gyeongsang|Gyeongsang]] Selatan ([[Busan]]) [[aksen nada]]:</b> ',
			'<span style="font-size: 13pt;">',
			w_HL .. '의 / ',
			w_HL .. '에 / ',
			w_HL .. '까지',
			'</span>',
			'<p style="font-size: 9pt; color:#505050"><i>Suku kata berwarna merah mengambil nada tinggi. This word always takes high pitch on the first syllable, dan merendahkan nada akhiran berikutnya.</i></p>',
			templatestyles
end

function p.LHH(frame)
	return  '<b>[[w:Dialek Gyeongsang|Gyeongsang]] Selatan ([[Busan]]) [[aksen nada]]:</b> ',
			'<span style="font-size: 13pt;">',
			w_LHH .. '의 / ',
			w_LHH .. '에 / ',
			w_LHH .. '까지',
			'</span>',
			'<p style="font-size: 9pt; color:#505050"><i>Suku kata berwarna merah mengambil nada tinggi. This word always takes high pitch on the second and third syllables, dan merendahkan nada akhiran berikutnya.</i></p>',
			templatestyles
end

function p.LHL(frame)
	return  '<b>[[w:Dialek Gyeongsang|Gyeongsang]] Selatan ([[Busan]]) [[aksen nada]]:</b> ',
			'<span style="font-size: 13pt;">',
			w_LHL .. '의 / ',
			w_LHL .. '에 / ',
			w_LHL .. '까지',
			'</span>',
			'<p style="font-size: 9pt; color:#505050"><i>Suku kata berwarna merah mengambil nada tinggi. This word always takes high pitch on the second syllable, dan merendahkan nada akhiran berikutnya.</i></p>',
			templatestyles
end

function p.LLH(frame)
	return  '<b>[[w:Dialek Gyeongsang|Gyeongsang]] Selatan ([[Busan]]) [[aksen nada]]:</b> ',
			'<span style="font-size: 13pt;">',
			w_LLH .. '의 / ',
			w_LLH .. '에 / ',
			w_L .. tag('까', 'H') .. '지',
			'</span>',
			'<p style="font-size: 9pt; color:#505050"><i>Suku kata berwarna merah mengambil nada tinggi. This word always takes high pitch on the final syllable, except before consonant-initial multisyllabic suffixes, when it takes full low pitch.</i></p>',
			templatestyles
end

function p.LLF(frame)
	return  '<b>[[w:Dialek Gyeongsang|Gyeongsang]] Selatan ([[Busan]]) [[aksen nada]]:</b> ',
			'<span style="font-size: 13pt;">',
			w_LLF .. '의 / ',
			w_LLF .. '에 / ',
			w_LLF .. '까지',
			'</span>',
			'<p style="font-size: 9pt; color:#505050"><i>Syllables in purple take falling pitch, a [[morae|bimoraic]] sequence of high to low pitch. Perkataan ini mengambil nada menurun pada suku kata terakhir, dan merendahkan nada akhiran berikutnya.</i></p>',
			templatestyles
end

function p.LLHL(frame)
	return  '<b>[[w:Dialek Gyeongsang|Gyeongsang]] Selatan ([[Busan]]) [[aksen nada]]:</b> ',
			'<span style="font-size: 13pt;">',
			w_LLH .. '의 / ',
			w_LLH .. '에 / ',
			w_LLH .. '까지',
			'</span>',
			'<p style="font-size: 9pt; color:#505050"><i>Suku kata berwarna merah mengambil nada tinggi. Perkataan ini selalu mengambil nada tinggi pada suku kata ketiga, dan merendahkan nada akhiran berikutnya.</i></p>',
			templatestyles
end

function p.LLLHL(frame)
	return  '<b>[[w:Dialek Gyeongsang|Gyeongsang]] Selatan ([[Busan]]) [[aksen nada]]:</b> ',
			'<span style="font-size: 13pt;">',
			w_LLLH .. '의 / ',
			w_LLLH .. '에 / ',
			w_LLLH .. '까지',
			'</span>',
			'<p style="font-size: 9pt; color:#505050"><i>Suku kata berwarna merah mengambil nada tinggi. Perkataan ini selalu mengambil nada tinggi pada suku kata keempat, dan merendahkan nada akhiran berikutnya.</i></p>',
			templatestyles
end

return p