<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.cultopedia.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AKo-translit</id>
	<title>Module:Ko-translit - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.cultopedia.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AKo-translit"/>
	<link rel="alternate" type="text/html" href="https://www.cultopedia.org/index.php?title=Module:Ko-translit&amp;action=history"/>
	<updated>2026-04-05T22:41:40Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.5</generator>
	<entry>
		<id>https://www.cultopedia.org/index.php?title=Module:Ko-translit&amp;diff=459&amp;oldid=prev</id>
		<title>imported&gt;Grapesurgeon: Undid revision 1324140459 by Grapesurgeon (talk) undoing for now; needs more polish</title>
		<link rel="alternate" type="text/html" href="https://www.cultopedia.org/index.php?title=Module:Ko-translit&amp;diff=459&amp;oldid=prev"/>
		<updated>2025-11-25T21:57:46Z</updated>

		<summary type="html">&lt;p&gt;Undid revision &lt;a href=&quot;/index.php/Special:Diff/1324140459&quot; title=&quot;Special:Diff/1324140459&quot;&gt;1324140459&lt;/a&gt; by &lt;a href=&quot;/index.php/Special:Contributions/Grapesurgeon&quot; title=&quot;Special:Contributions/Grapesurgeon&quot;&gt;Grapesurgeon&lt;/a&gt; (&lt;a href=&quot;/index.php?title=User_talk:Grapesurgeon&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User talk:Grapesurgeon (page does not exist)&quot;&gt;talk&lt;/a&gt;) undoing for now; needs more polish&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
local find = mw.ustring.find&lt;br /&gt;
local gsub = mw.ustring.gsub&lt;br /&gt;
local m_data = require(&amp;#039;Module:Ko-translit/data&amp;#039;)&lt;br /&gt;
local m_utils = require(&amp;#039;Module:Ko-utils&amp;#039;)&lt;br /&gt;
local get_args = require(&amp;#039;Module:Arguments&amp;#039;).getArgs&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
IMPORTANT NOTE before editing this module:&lt;br /&gt;
1. Make sure that you use a font that displays the following characters differently, and that you know the differences of them:&lt;br /&gt;
	ᄀ (U+1100)&lt;br /&gt;
	ᆨ (U+11A8)&lt;br /&gt;
	ㄱ (U+3131)&lt;br /&gt;
2. When dealing with decomposed Hangul,&lt;br /&gt;
	a. [ᄀ-ᄒ] should not be directly followed by [ᅡ-ᅵ] because MediaWiki uses Unicode Normalization Form C (NFC), which converts any sequence of [ᄀ-ᄒ][ᅡ-ᅵ] into a precomposed character; write ᄀ[ᅡ] or ᄀ(ᅡ)&lt;br /&gt;
	b. ᄀ[ᅡ] or ᄀ(ᅡ) at the end of a pattern is equivalent to not just 가 but [가-갛] in precomposed form. To match a syllabic block without a final consonant at the end of a pattern, use both vowel + [^ᆨ-ᇂ] and vowel + $&lt;br /&gt;
		For example, to only match 가 (and not [각-갛]) at the end of a pattern, use both ᄀ[ᅡ][^ᆨ-ᇂ] and ᄀ[ᅡ]$&lt;br /&gt;
--]]&lt;br /&gt;
&lt;br /&gt;
local function gsub_iterate(text, table)&lt;br /&gt;
	for _, entry in ipairs(table) do&lt;br /&gt;
		text = gsub(text, entry[1], entry[2])&lt;br /&gt;
	end&lt;br /&gt;
	return text&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function remove_links_and_markup(text)&lt;br /&gt;
	-- these either are unnecessary or interfere with assimilation&lt;br /&gt;
&lt;br /&gt;
	-- remove bold/italic&lt;br /&gt;
	-- it is not impossible to allow bold/italic when it does not interfere with assimilation, but determining when to allow or disallow that adds complication for little practical gain&lt;br /&gt;
	text = gsub(text, &amp;quot;&amp;#039;&amp;#039;&amp;#039;&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
	text = gsub(text, &amp;quot;&amp;#039;&amp;#039;&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	-- remove HTML tags (except br)&lt;br /&gt;
	text = gsub(text, &amp;quot;&amp;lt;[Bb][Rr] */?&amp;gt;&amp;quot;, &amp;quot;&amp;amp;#10;&amp;quot;)&lt;br /&gt;
	text = gsub(text, &amp;quot;&amp;lt;/?[A-Za-z][^&amp;gt;]-&amp;gt;&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
	text = gsub(text, &amp;quot;&amp;amp;#10;&amp;quot;, &amp;quot;&amp;lt;br&amp;gt;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	-- remove wikilinks&lt;br /&gt;
	text = gsub(text, &amp;quot;%[%[[^%|]+%|(..-)%]%]&amp;quot;, &amp;quot;%1&amp;quot;)&lt;br /&gt;
	text = gsub(gsub(text, &amp;quot;%[%[&amp;quot;, &amp;quot;&amp;quot;), &amp;quot;%]%]&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	text = mw.text.killMarkers(text)&lt;br /&gt;
&lt;br /&gt;
	return text&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function disallow_invalid_input(text)&lt;br /&gt;
	-- very first step&lt;br /&gt;
	-- Hangul status: precomposed (한)&lt;br /&gt;
&lt;br /&gt;
	-- input must contain Hangul&lt;br /&gt;
	if not m_utils.contains_hangul(text) then&lt;br /&gt;
		error(&amp;quot;Input must contain Hangul&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- no direct insertion of reference or footnote&lt;br /&gt;
	if m_utils.contains_reference(text) then&lt;br /&gt;
		error(&amp;quot;Input cannot contain references&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- if input contains Hangul not supported by RR and MR, change text to &amp;quot;N/A&amp;quot; and skip everything&lt;br /&gt;
	if find(text, &amp;quot;[ᄓ-ᅠᅶ-ᆧᇃ-ᇿ〮〯ㅤ-ㆎꥠ-꥿ힰ-퟿]&amp;quot;) then&lt;br /&gt;
		text = &amp;quot;N/A&amp;quot;&lt;br /&gt;
		return text&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	text = gsub_iterate(text, m_data.escaped_to_html_enc) -- replacing escaped special chars with placeholders&lt;br /&gt;
&lt;br /&gt;
	-- various validations of input&lt;br /&gt;
	if find(text, &amp;quot;[ᄀ-ᄒ]&amp;quot;) or find(text, &amp;quot;[ᅡ-ᅵᆨ-ᇂ]&amp;quot;) then&lt;br /&gt;
		error(&amp;quot;Do not input conjoining Hangul jamo directly&amp;quot;)&lt;br /&gt;
	elseif find(text, &amp;quot;`%*&amp;quot;) then&lt;br /&gt;
		error(&amp;quot;Use *` instead of `*&amp;quot;)&lt;br /&gt;
	elseif find(text, &amp;quot;@%*&amp;quot;) then&lt;br /&gt;
		error(&amp;quot;Use *@ instead of @*&amp;quot;)&lt;br /&gt;
	elseif find(text, &amp;quot;%^[^가-힣]&amp;quot;) then&lt;br /&gt;
		error(&amp;quot;^ must be immediately followed by Hangul syllabic block&amp;quot;)&lt;br /&gt;
	elseif find(text, &amp;quot;[^%*0-9A-Za-z]`&amp;quot;) or find(text, &amp;quot;[^0-9A-Za-z]%*`&amp;quot;) or find(text, &amp;quot;`[^가-깋다-딯바-빟자-짛]&amp;quot;) then&lt;br /&gt;
		error(&amp;quot;Found invalid sequence containing `&amp;quot;)&lt;br /&gt;
	elseif find(text, &amp;quot;[^%*ㄹ가-힣]@&amp;quot;) or find(text, &amp;quot;[^가-힣]%*@&amp;quot;) or find(text, &amp;quot;%*@[^가-깋다-딯바-빟자-짛]&amp;quot;) or find(text, &amp;quot;ㄹ@[^가-깋다-딯바-빟사-싷자-짛]&amp;quot;) or find(text, &amp;quot;@[^가-깋다-딯라-맇바-빟사-싷야-얳여-옣요-욯유-윶윸-윻이-잍잏자-짛하-힣]&amp;quot;) then&lt;br /&gt;
		error(&amp;quot;Found invalid sequence containing @&amp;quot;)&lt;br /&gt;
	elseif find(text, &amp;quot;[^가-힣]%$&amp;quot;) or find(text, &amp;quot;%$[^아어에엔엘여요으은을음읍의이인일임입]&amp;quot;) then&lt;br /&gt;
		error(&amp;quot;Found invalid sequence containing $&amp;quot;)&lt;br /&gt;
	elseif find(text, &amp;quot;%%$&amp;quot;) then&lt;br /&gt;
		error(&amp;quot;Remove final %&amp;quot;)&lt;br /&gt;
	elseif find(text, &amp;quot;[ _][ _]&amp;quot;) then&lt;br /&gt;
		error(&amp;quot;No two or more consecutive space characters&amp;quot;)&lt;br /&gt;
	elseif find(text, &amp;quot;^[%$%*@_`]&amp;quot;) or find(text, &amp;quot;^%%[^_가-힣]&amp;quot;) or find(text, &amp;quot;[ _]%*&amp;quot;) or find(text, &amp;quot;%*[ %*%-_]&amp;quot;) or find(text, &amp;quot;%-%*&amp;quot;) or find(text, &amp;quot;[﷐-﷒]&amp;quot;) or find(text, &amp;quot;%%_$&amp;quot;) or find(text, &amp;quot;[%$%*@%^`]$&amp;quot;) then&lt;br /&gt;
		error(&amp;quot;Invalid input&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return text&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function check_invalid_seq(text)&lt;br /&gt;
	-- validity check after removing links and markups (before decomposing Hangul)&lt;br /&gt;
	-- Hangul status: precomposed (한)&lt;br /&gt;
&lt;br /&gt;
	if find(text, &amp;quot;[ _][ _]&amp;quot;) then&lt;br /&gt;
		error(&amp;quot;No two or more consecutive space characters&amp;quot;)&lt;br /&gt;
	elseif find(text, &amp;quot;^[%$%*@_`]&amp;quot;) or find(text, &amp;quot;[ _]%*&amp;quot;) or find(text, &amp;quot;%*[ %*%-_]&amp;quot;) or find(text, &amp;quot;%-%*&amp;quot;) or find(text, &amp;quot;[%$%*@%^_`]$&amp;quot;) then&lt;br /&gt;
		error(&amp;quot;Invalid input&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return text&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function check_invalid_seq_decomposed_hangul(text)&lt;br /&gt;
	-- validity check after decomposing Hangul&lt;br /&gt;
	-- Hangul status: decomposed (ᄒ+ᅡ+ᆫ)&lt;br /&gt;
&lt;br /&gt;
	if find(text, &amp;quot;[ᆨ-ᆪᆬ-ᆮᆴ-ᆶᆸᆹᆻᆽ-ᇂ]%*?﷐?@﷐?[ᄀᄃᄇᄉᄌ]&amp;quot;) or find(text, &amp;quot;ᆰ%*?﷐?@﷐?[ᄀ-ᄊᄌ-ᄑ]&amp;quot;) or find(text, &amp;quot;ᆲ﷐?@﷐?[ᄀ-ᄊᄌ-ᄑ]&amp;quot;) or find(text, &amp;quot;ᆺ%*@[ᄀᄇ]&amp;quot;) or find(text, &amp;quot;ᆺ%*?﷐?@﷐?[ᄁ-ᄆᄈ-ᄊᄌ-ᄑ]&amp;quot;) or find(text, &amp;quot;[ᅡ-ᅵᆨ-ᆪᆬ-ᇂ]﷐?@﷐?ᄅ&amp;quot;) or find(text, &amp;quot;[ᅡ-ᅵ]﷐?@﷐?ᄋ&amp;quot;) or find(text, &amp;quot;[ᅡ-ᅵᆫ-ᆭᆯᆱ-ᆷᆼ]﷐?@﷐?ᄒ&amp;quot;) then&lt;br /&gt;
		error(&amp;quot;Found invalid sequence containing @&amp;quot;)&lt;br /&gt;
	elseif find(text, &amp;quot;[ᅡ-ᅵᆨᆫᆭ-ᆯᆶ-ᆸᆼ]﷐?%$&amp;quot;) then&lt;br /&gt;
		error(&amp;quot;Found invalid sequence containing $&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return text&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function parse_name(text)&lt;br /&gt;
	-- processing people names&lt;br /&gt;
	-- Hangul status: precomposed (한)&lt;br /&gt;
&lt;br /&gt;
	local hanja_readings_final_L = &amp;quot;갈걸결골괄굴궐귤글길날녈놜눌닐달돌랄렬률말멸몰물밀발벌별불살설솔술슬실알얼열올왈울월율을일절졸줄즐질찰철촬출칠탈팔필할헐혈홀활훌휼흘힐&amp;quot;&lt;br /&gt;
	local hanja_readings_init_DSJ = &amp;quot;다단달담답당대댁덕도독돈돌동두둔득등사삭산살삼삽상새색생서석선설섬섭성세소속손솔송쇄쇠수숙순술숭쉬슬습승시식신실심십자작잔잠잡장재쟁저적전절점접정제조족존졸종좌죄주죽준줄중즉즐즙증지직진질짐집징&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	-- note: internally uses 3 noncharacters&lt;br /&gt;
	-- ﷐ (U+FDD0): mostly for given name in RR&lt;br /&gt;
	-- ﷑ (U+FDD1): marks beginning of name&lt;br /&gt;
	-- ﷒ (U+FDD2): marks end of name&lt;br /&gt;
&lt;br /&gt;
	-- change % to U+FDD1 and U+FDD2 (end of string also terminates name mode)&lt;br /&gt;
	text = gsub(text, &amp;quot;%%([^%%]*)%%&amp;quot;, &amp;quot;﷑%1﷒&amp;quot;)&lt;br /&gt;
	text = gsub(text, &amp;quot;%%([^%%]*)$&amp;quot;, &amp;quot;﷑%1﷒&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	-- disallow invalid input for name&lt;br /&gt;
	if find(text, &amp;quot;﷑_?﷒&amp;quot;) then&lt;br /&gt;
		error(&amp;quot;Name cannot be empty&amp;quot;)&lt;br /&gt;
	elseif find(text, &amp;quot;﷑[^﷑﷒]*[^가-힣_ ][^﷑﷒]*﷒&amp;quot;) then&lt;br /&gt;
		error(&amp;quot;Invalid character in name&amp;quot;)&lt;br /&gt;
	elseif find(text, &amp;quot;﷑ &amp;quot;) then&lt;br /&gt;
		error(&amp;quot;Name cannot begin with space&amp;quot;)&lt;br /&gt;
	elseif find(text, &amp;quot; ﷒&amp;quot;) then&lt;br /&gt;
		error(&amp;quot;Name cannot end with space&amp;quot;)&lt;br /&gt;
	elseif find(text, &amp;quot;﷑[^﷒]*[ _][^﷒]*[ _][^﷒]*﷒&amp;quot;) then&lt;br /&gt;
		error(&amp;quot;No more than two components in name&amp;quot;)&lt;br /&gt;
	elseif find(text, &amp;quot;﷑[가-힣]_&amp;quot;) then&lt;br /&gt;
		error(&amp;quot;No _ after one-syllable surname&amp;quot;)&lt;br /&gt;
	elseif find(text, &amp;quot;﷑[^﷒]*[&amp;quot; .. hanja_readings_final_L .. &amp;quot;]@[&amp;quot; .. hanja_readings_init_DSJ .. &amp;quot;][^﷒]*﷒&amp;quot;) then&lt;br /&gt;
		error(&amp;quot;Contains unnecessary @ in name&amp;quot;) -- see below&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- separate surname and given name&lt;br /&gt;
	-- if input contains _ or space, separate there&lt;br /&gt;
	text = gsub(text, &amp;quot;﷑([가-힣%$@]+)_﷒&amp;quot;, &amp;quot;﷑^%1_﷒&amp;quot;) -- for surname-only string&lt;br /&gt;
	text = gsub(text, &amp;quot;﷑_([가-힣%$@]+)﷒&amp;quot;, &amp;quot;﷑_^%1﷒&amp;quot;) -- for mononym&lt;br /&gt;
	text = gsub(text, &amp;quot;﷑([가-힣%$@]+)[ _]([가-힣%$@]+)﷒&amp;quot;, &amp;quot;﷑^%1_^%2﷒&amp;quot;)&lt;br /&gt;
	-- otherwise, separate after first syllabic block&lt;br /&gt;
	text = gsub(text, &amp;quot;﷑([가-힣])﷒&amp;quot;, &amp;quot;﷑^%1_﷒&amp;quot;) -- for surname-only string&lt;br /&gt;
	text = gsub(text, &amp;quot;﷑([가-힣])([가-힣%$@]+)﷒&amp;quot;, &amp;quot;﷑^%1_^%2﷒&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	-- check invalid input after separating surname and given name&lt;br /&gt;
	if find(text, &amp;quot;﷑[^﷒]*_%^[%$@][^﷒]*﷒&amp;quot;) then&lt;br /&gt;
		error(&amp;quot;No @ or $ between surname and given name&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- tensification of ㄹ + {ㄷ, ㅅ, ㅈ} (needed for MR; e.g. 홍길동 [홍길똥], 을지문덕 [을찌문덕])&lt;br /&gt;
	-- does not occur when same syllable is repeated (e.g. 구구절절 [구구절절], not [구구절쩔]); just using U+FDD0 here too&lt;br /&gt;
	for i = 1, mw.ustring.len(text) do&lt;br /&gt;
		text = gsub(text, &amp;quot;﷑([^﷒]*)([달돌살설솔술슬실절졸줄즐질])%2([^﷒]*)﷒&amp;quot;, &amp;quot;﷑%1%2﷐%2%3﷒&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	-- now apply tensification&lt;br /&gt;
	for i = 1, mw.ustring.len(text) do&lt;br /&gt;
		text = gsub(text, &amp;quot;﷑([^﷒]*)([&amp;quot; .. hanja_readings_final_L .. &amp;quot;])([&amp;quot; .. hanja_readings_init_DSJ .. &amp;quot;])([^﷒]*)﷒&amp;quot;, &amp;quot;﷑%1%2@%3%4﷒&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- insert U+FDD0 in given name (needed for RR; e.g. 한복남 Han Boknam, not Han Bongnam)&lt;br /&gt;
	for i = 1, mw.ustring.len(text) do&lt;br /&gt;
		text = gsub(text, &amp;quot;﷑([^﷒]*)_%^([^﷒]*)([가-힣%$@])([가-힣%$@])([^﷒]*)﷒&amp;quot;, &amp;quot;﷑%1_^%2%3﷐%4%5﷒&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- remove _ which was needed for surname-only string and mononym&lt;br /&gt;
	text = gsub(text, &amp;quot;_﷒&amp;quot;, &amp;quot;﷒&amp;quot;)&lt;br /&gt;
	text = gsub(text, &amp;quot;﷑_%^&amp;quot;, &amp;quot;﷑^&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	text = gsub(text, &amp;quot;[﷑﷒]&amp;quot;, &amp;quot;&amp;quot;) -- remove U+FDD1 and U+FDD2&lt;br /&gt;
&lt;br /&gt;
	return text&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function final_processing(text)&lt;br /&gt;
	-- final processing for RR and MR&lt;br /&gt;
&lt;br /&gt;
	-- result should not contain Hangul&lt;br /&gt;
	if m_utils.contains_hangul(text) then&lt;br /&gt;
		error(&amp;quot;Result contains Hangul; debugging required&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	text = gsub_iterate(text, m_data.html_enc_to_ascii) -- convert HTML encodings back to ASCII&lt;br /&gt;
&lt;br /&gt;
	-- if result is nothing (e.g. when input is just ㅇ)&lt;br /&gt;
	if text == &amp;quot;&amp;quot; then&lt;br /&gt;
		text = &amp;quot;—&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return text&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Convert to Revised Romanization&lt;br /&gt;
function p.rr(frame)&lt;br /&gt;
	return p._rr(get_args(frame))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._rr(args)&lt;br /&gt;
	local text = args[1]&lt;br /&gt;
	text = disallow_invalid_input(text)&lt;br /&gt;
	if text == &amp;quot;N/A&amp;quot; then&lt;br /&gt;
		return text&lt;br /&gt;
	end&lt;br /&gt;
	text = parse_name(text)&lt;br /&gt;
	text = remove_links_and_markup(text)&lt;br /&gt;
	text = check_invalid_seq(text)&lt;br /&gt;
	text = gsub(text, &amp;quot;`&amp;quot;, &amp;quot;&amp;quot;) -- ignore ` (only needed for MR; not needed for RR)&lt;br /&gt;
	text = gsub_iterate(text, m_data.enclosed_hangul)&lt;br /&gt;
	text = m_utils.decompose_hangul(text) -- decompose Hangul&lt;br /&gt;
	text = check_invalid_seq_decomposed_hangul(text)&lt;br /&gt;
	text = gsub(text, &amp;quot;%*&amp;quot;, &amp;quot;-&amp;quot;) -- * for additional hyphen in romanization only&lt;br /&gt;
	text = gsub_iterate(text, m_data.preprocessing)&lt;br /&gt;
&lt;br /&gt;
	text = gsub(text, &amp;quot;ᇂᄉ&amp;quot;, &amp;quot;ᄉ&amp;quot;) -- convert remaining ㅎ combination&lt;br /&gt;
	text = gsub_iterate(text, m_data.neutralize_syl_final_consonants) -- neutralization of syl-final consonants&lt;br /&gt;
	text = gsub_iterate(text, m_data.at_dollar_irregularities) -- @ for ㄴㄹ pronounced [ㄴㄴ], $ for 절음 법칙&lt;br /&gt;
	text = gsub_iterate(text, m_data.at_irregularities_additional_rr) -- @ for ㄱㅎ/ㄷㅎ/ㅂㅎ → k/t/p&lt;br /&gt;
	text = gsub_iterate(text, m_data.consonant_assimilations) -- consonant assimilations&lt;br /&gt;
	text = gsub(text, &amp;quot;ᆯᄅ&amp;quot;, &amp;quot;ᆯl&amp;quot;) -- ㄹㄹ is ll&lt;br /&gt;
	text = gsub_iterate(text, m_data.drop_y) -- drop y after {ㅈ, ㅉ, ㅊ}&lt;br /&gt;
	text = gsub_iterate(text, m_data.vowels_rr) -- replace Hangul vowels with romanized text&lt;br /&gt;
	text = gsub(text, &amp;quot;&amp;#039;([ᄋㅇ]+)&amp;#039;&amp;quot;, &amp;quot;&amp;amp;#39;%1&amp;amp;#39;&amp;quot;) -- to prevent input like &amp;#039;ㅇ&amp;#039; (with &amp;#039;) from becoming italic markup (as [ᄋㅇ] is simply removed later)&lt;br /&gt;
	text = gsub_iterate(text, m_data.single_consonants_rr) -- replace single consonants with romanized text&lt;br /&gt;
	text = gsub(text, &amp;quot;﷐&amp;quot;, &amp;quot;&amp;quot;) -- now remove U+FDD0 that was needed for converting each syllabic block in given name separately (e.g. 한복남 Han Boknam, not Han Bongnam)&lt;br /&gt;
&lt;br /&gt;
	-- ^ for capitalization&lt;br /&gt;
	text = gsub(text, &amp;quot;%^[a-eg-km-pr-uwy]&amp;quot;, mw.ustring.upper)&lt;br /&gt;
	text = gsub(text, &amp;quot;%^&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	text = final_processing(text)&lt;br /&gt;
&lt;br /&gt;
	return text&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Convert to McCune–Reischauer&lt;br /&gt;
function p.mr(frame)&lt;br /&gt;
	return p._mr(get_args(frame))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._mr(args)&lt;br /&gt;
	local text = args[1]&lt;br /&gt;
	text = disallow_invalid_input(text)&lt;br /&gt;
	if text == &amp;quot;N/A&amp;quot; then&lt;br /&gt;
		return text&lt;br /&gt;
	end&lt;br /&gt;
	text = parse_name(text)&lt;br /&gt;
	text = gsub(text, &amp;quot;﷐&amp;quot;, &amp;quot;&amp;quot;) -- remove U+FDD0 (only needed for RR; not needed for MR)&lt;br /&gt;
	text = remove_links_and_markup(text)&lt;br /&gt;
	text = check_invalid_seq(text)&lt;br /&gt;
	text = gsub_iterate(text, m_data.enclosed_hangul)&lt;br /&gt;
	text = m_utils.decompose_hangul(text) -- decompose Hangul&lt;br /&gt;
	text = check_invalid_seq_decomposed_hangul(text)&lt;br /&gt;
	text = gsub(text, &amp;quot;([ᄀᄁᄃ-ᄊᄌ-ᄑ])ᅴ&amp;quot;, &amp;quot;%1ᅵ&amp;quot;) -- syl-init consonant + ㅢ → syl-init consonant + ㅣ (except 의, 늬, 희)&lt;br /&gt;
	text = gsub_iterate(text, m_data.preprocessing)&lt;br /&gt;
&lt;br /&gt;
	text = gsub_iterate(text, m_data.before_neutralizing_syl_final_consonants_mr) -- should be done before neutralization of syl-final consonants&lt;br /&gt;
	text = gsub_iterate(text, m_data.neutralize_syl_final_consonants) -- neutralization of syl-final consonants&lt;br /&gt;
	text = gsub(text, &amp;quot;([ᅡ-ᅵᆫᆷᆼ])@ᄉ&amp;quot;, &amp;quot;%1ᄊ&amp;quot;) -- @ for tensification&lt;br /&gt;
	text = gsub_iterate(text, m_data.at_dollar_irregularities) -- @ for ㄴㄹ pronounced [ㄴㄴ], $ for 절음 법칙&lt;br /&gt;
	text = gsub_iterate(text, m_data.gdbj_mr) -- cases where ㄱ, ㄷ, ㅂ, ㅈ become voiced consonants&lt;br /&gt;
	text = gsub(text, &amp;quot;ᆯ%*ᄅ&amp;quot;, &amp;quot;ᆯ-l&amp;quot;) -- ㄹ-ㄹ should probably be l-l rather than l-r&lt;br /&gt;
	text = gsub(text, &amp;quot;%*&amp;quot;, &amp;quot;-&amp;quot;) -- * for additional hyphen in romanization only&lt;br /&gt;
	text = gsub(text, &amp;quot;@&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	-- consonant assimilations&lt;br /&gt;
	text = gsub_iterate(text, m_data.consonant_assimilations)&lt;br /&gt;
	text = gsub_iterate(text, m_data.consonant_assimilations_additional_mr)&lt;br /&gt;
&lt;br /&gt;
	text = gsub_iterate(text, m_data.drop_y) -- drop y after {ㅈ, ㅉ, ㅊ}&lt;br /&gt;
	text = gsub_iterate(text, m_data.vowels_mr) -- replace Hangul vowels with romanized text&lt;br /&gt;
	text = gsub(text, &amp;quot;([ao])ᄋe&amp;quot;, &amp;quot;%1ë&amp;quot;) -- ㅏ에 (aë) and ㅗ에 (oë)&lt;br /&gt;
	text = gsub(text, &amp;quot;&amp;#039;([ᄋㅇ]+)&amp;#039;&amp;quot;, &amp;quot;&amp;amp;#39;%1&amp;amp;#39;&amp;quot;) -- to prevent input like &amp;#039;ㅇ&amp;#039; (with &amp;#039;) from becoming italic markup (as [ᄋㅇ] is simply removed later)&lt;br /&gt;
	text = gsub_iterate(text, m_data.single_consonants_mr) -- replace single consonants with romanized text&lt;br /&gt;
&lt;br /&gt;
	-- replace &amp;#039; with &amp;amp;#39; when followed by another &amp;#039; or at end of string (to avoid possible clashes with bold/italic markup)&lt;br /&gt;
	text = gsub(text, &amp;quot;([hkpt])&amp;#039;&amp;#039;&amp;quot;, &amp;quot;%1&amp;amp;#39;&amp;#039;&amp;quot;)&lt;br /&gt;
	text = gsub(text, &amp;quot;([hkpt])&amp;#039;$&amp;quot;, &amp;quot;%1&amp;amp;#39;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	-- ^ for capitalization&lt;br /&gt;
	text = gsub(text, &amp;quot;%^[acehikm-pr-uwyŏŭ]&amp;quot;, mw.ustring.upper)&lt;br /&gt;
	text = gsub(text, &amp;quot;%^&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	text = final_processing(text)&lt;br /&gt;
&lt;br /&gt;
	return text&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Removing special chars (except for escaped ones)&lt;br /&gt;
function p.clean_hangul(frame)&lt;br /&gt;
	return p._clean_hangul(get_args(frame))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._clean_hangul(args)&lt;br /&gt;
	local text = args[1]&lt;br /&gt;
&lt;br /&gt;
	-- input must contain Hangul&lt;br /&gt;
	if not m_utils.contains_hangul(text) then&lt;br /&gt;
		error(&amp;quot;Input must contain Hangul&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- no direct insertion of reference or footnote&lt;br /&gt;
	if m_utils.contains_reference(text) then&lt;br /&gt;
		error(&amp;quot;Input cannot contain references&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- symbol should not appear within single syllabic block&lt;br /&gt;
	if find(text, &amp;quot;[ᄀ-ᅟꥠ-ꥼ][%$%%%*@%^_`][ᅠ-ᆧힰ-ퟆ]&amp;quot;) or find(text, &amp;quot;[ᅠ-ᆧ가개갸걔거게겨계고과괘괴교구궈궤귀규그긔기까깨꺄꺠꺼께껴꼐꼬꽈꽤꾀꾜꾸꿔꿰뀌뀨끄끠끼나내냐냬너네녀녜노놔놰뇌뇨누눠눼뉘뉴느늬니다대댜댸더데뎌뎨도돠돼되됴두둬뒈뒤듀드듸디따때땨떄떠떼뗘뗴또똬뙈뙤뚀뚜뚸뛔뛰뜌뜨띄띠라래랴럐러레려례로롸뢔뢰료루뤄뤠뤼류르릐리마매먀먜머메며몌모뫄뫠뫼묘무뭐뭬뮈뮤므믜미바배뱌뱨버베벼볘보봐봬뵈뵤부붜붸뷔뷰브븨비빠빼뺘뺴뻐뻬뼈뼤뽀뽜뽸뾔뾰뿌뿨쀄쀠쀼쁘쁴삐사새샤섀서세셔셰소솨쇄쇠쇼수숴쉐쉬슈스싀시싸쌔쌰썌써쎄쎠쎼쏘쏴쐐쐬쑈쑤쒀쒜쒸쓔쓰씌씨아애야얘어에여예오와왜외요우워웨위유으의이자재쟈쟤저제져졔조좌좨죄죠주줘줴쥐쥬즈즤지짜째쨔쨰쩌쩨쪄쪠쪼쫘쫴쬐쬬쭈쭤쮀쮜쮸쯔쯰찌차채챠챼처체쳐쳬초촤쵀최쵸추춰췌취츄츠츼치카캐캬컈커케켜켸코콰쾌쾨쿄쿠쿼퀘퀴큐크킈키타태탸턔터테텨톄토톼퇘퇴툐투퉈퉤튀튜트틔티파패퍄퍠퍼페펴폐포퐈퐤푀표푸풔풰퓌퓨프픠피하해햐햬허헤혀혜호화홰회효후훠훼휘휴흐희히ힰ-ퟆ][%$%%%*@%^_`][ᆨ-ᇿퟋ-ퟻ]&amp;quot;) then&lt;br /&gt;
		error(&amp;quot;Do not insert symbol within single syllabic block&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	text = gsub_iterate(text, m_data.escaped_to_html_enc) -- replacing escaped special chars with placeholders&lt;br /&gt;
	text = gsub(text, &amp;quot;[%$%%%*@%^_`]&amp;quot;, &amp;quot;&amp;quot;) -- removing non-escaped special chars&lt;br /&gt;
	text = gsub_iterate(text, m_data.html_enc_to_ascii) -- convert HTML encodings back to ASCII&lt;br /&gt;
	text = mw.text.unstrip(text) -- unstripping test&lt;br /&gt;
&lt;br /&gt;
	return text&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Grapesurgeon</name></author>
	</entry>
</feed>