Module:ko-tone

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 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_H .. '의 / ', w_H .. '에 / ', w_L .. tag('까', 'H') .. '지', ' ',			'''Syllables in red take high pitch. This word takes low pitch only before consonant-initial multisyllabic suffixes.'' ', templatestyles end

function p.H_H_reg(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_H .. tag('의', 'H') .. ' / ',			w_H .. tag('에', 'H') .. ' / ',			w_H .. tag('까', 'H') .. '지', ' ',			'''Syllables in red take high pitch. This word always takes high pitch and also heightens the next suffixed syllable.'' ', templatestyles end

function p.H_H_irreg(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_H .. tag('의', 'H') .. ' / ',			w_H .. '에 / ', w_H .. tag('까', 'H') .. '지', ' ',			'''Syllables in red take high pitch. This word always takes high pitch and also heightens the next suffixed syllable, unless it is 에.'' ', templatestyles end

function p.F(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_F .. '의 / ', w_F .. '에 / ', w_F .. '까지', ' ',			'''Syllables in purple take falling pitch, a bimoraic sequence of high to low pitch. This word always takes falling pitch, and lowers the pitch of subsequent suffixes.'' ', templatestyles end

function p.R(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_R .. '의 / ', w_R .. '에 / ', w_R .. '까지', ' ',			'''Syllables in blue take rising pitch, a bimoraic sequence of low to high pitch. This word always takes rising pitch, and lowers the pitch of subsequent suffixes.'' ', templatestyles end

function p.L_reg(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_L .. tag('의', 'H') .. ' / ',			w_L .. tag('에', 'H') .. ' / ',			w_L .. tag('까지', 'H'), ' ',			'''Syllables in red take high pitch. This word always takes low pitch, and heightens the pitch of two subsequent suffixed syllables.'' ', templatestyles end

function p.HH(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_H .. '의 / ', w_H .. '에 / ', w_H .. '까지', ' ',			'''Syllables in red take high pitch. This word always takes high pitch on both syllables, and lowers the pitch of subsequent suffixes.'' ', templatestyles end

function p.HL(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_HL .. '의 / ', w_HL .. '에 / ', w_HL .. '까지', ' ',			'''Syllables in red take high pitch. This word always takes high pitch only on the first syllable, and lowers the pitch of subsequent suffixes.'' ', templatestyles end

function p.LH_reg(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_LHH .. '의 / ', w_LHH .. '에 / ', w_L .. tag('까', 'H') .. '지', ' ',			'''Syllables in red take high pitch. This word always takes high pitch only on the second syllable, except before consonant-initial multisyllabic suffixes, when it takes full low pitch.'' ', templatestyles end

function p.LH_part_reg(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_LHH .. '의 / ', w_LHH .. '에 / ', w_LHH .. tag('까', 'H') .. '지', ' ',			'''Syllables in red take high pitch. This word always takes high pitch only on the second syllable, and heightens the first syllable of subsequent consonant-initial multisyllabic suffixes.'' ', templatestyles end

function p.LH_H(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_LHH .. tag('의', 'H') .. ' / ',			w_LHH .. tag('에', 'H') .. ' / ',			w_LHH .. tag('까', 'H') .. '지', ' ',			'''Syllables in red take high pitch. This word always takes high pitch only on the second syllable, and also heightens the subsequent suffixed syllable.'' ', templatestyles end

function p.LF(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_LFF .. '의 / ', w_LFF .. '에 / ', w_LFF .. '까지', ' ',			'''Syllables in purple take falling pitch, a bimoraic sequence of high to low pitch. This word always takes falling pitch on the second and third syllables, and lowers the pitch of subsequent suffixes.'' ', templatestyles end

function p.HHL(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_HHL .. '의 / ', w_HHL .. '에 / ', w_HHL .. '까지', ' ',			'''Syllables in red take high pitch. This word always takes high pitch on the first two syllables, and lowers the pitch of subsequent suffixes.'' ', templatestyles end

function p.HLL(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_HL .. '의 / ', w_HL .. '에 / ', w_HL .. '까지', ' ',			'''Syllables in red take high pitch. This word always takes high pitch on the first syllable, and lowers the pitch of subsequent suffixes.'' ', templatestyles end

function p.LHH(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_LHH .. '의 / ', w_LHH .. '에 / ', w_LHH .. '까지', ' ',			'''Syllables in red take high pitch. This word always takes high pitch on the second and third syllables, and lowers the pitch of subsequent suffixes.'' ', templatestyles end

function p.LHL(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_LHL .. '의 / ', w_LHL .. '에 / ', w_LHL .. '까지', ' ',			'''Syllables in red take high pitch. This word always takes high pitch on the second syllable, and lowers the pitch of subsequent suffixes.'' ', templatestyles end

function p.LLH(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_LLH .. '의 / ', w_LLH .. '에 / ', w_L .. tag('까', 'H') .. '지', ' ',			'<p style="font-size: 9pt; color:#505050">''Syllables in red take high pitch. This word always takes high pitch on the final syllable, except before consonant-initial multisyllabic suffixes, when it takes full low pitch.'' ', templatestyles end

function p.LLF(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_LLF .. '의 / ', w_LLF .. '에 / ', w_LLF .. '까지', ' ',			'<p style="font-size: 9pt; color:#505050">''Syllables in purple take falling pitch, a bimoraic sequence of high to low pitch. This word takes falling pitch on the final syllable, and lowers the pitch of subsequent suffixes.'' ', templatestyles end

function p.LHL_phrase(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_LHL .. ' ',			'<p style="font-size: 9pt; color:#505050">The syllable in red takes high pitch. ', templatestyles end

function p.HHL_isol(frame) return 'South Gyeongsang (Busan) pitch accent [high-pitch in red] : ', ' ',			w_HHL .. ' ',			templatestyles end

function p.LLH_isol(frame) return 'South Gyeongsang (Busan) pitch accent [high-pitch in red] : ', ' ',			w_LLH .. ' ',			templatestyles end

function p.LH_phrase(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_LHH .. ' ',			'<p style="font-size: 9pt; color:#505050">The syllable in red takes high pitch. ', templatestyles end

function p.HH_phrase(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_H .. ' ',			'<p style="font-size: 9pt; color:#505050">Syllables in red take high pitch. ', templatestyles end

function p.LLHL(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_LLH .. '의 / ', w_LLH .. '에 / ', w_LLH .. '까지', ' ',			'<p style="font-size: 9pt; color:#505050">''Syllables in red take high pitch. This word always takes high pitch on the third syllable, and lowers the pitch of subsequent suffixes.'' ', templatestyles end

function p.LHHL(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_LHH .. '의 / ', w_LHH .. '에 / ', w_LHH .. '까지', ' ',			'<p style="font-size: 9pt; color:#505050">''Syllables in red take high pitch. This word always takes high pitch on the two middle syllables, and lowers the pitch of subsequent suffixes.'' ', templatestyles end

function p.LLLHL(frame) return 'South Gyeongsang (Busan) pitch accent: ', ' ',			w_LLLH .. '의 / ', w_LLLH .. '에 / ', w_LLLH .. '까지', ' ',			'<p style="font-size: 9pt; color:#505050">''Syllables in red take high pitch. This word always takes high pitch on the fourth syllable, and lowers the pitch of subsequent suffixes.'' ', templatestyles end

return p