local export = {}

function export.show(frame)
	local params = {
		["dk"] = { default = 0 },
		["m"] = { default = 0 },
		["mh"] = { default = 0 },
		["ml"] = { default = 0 },
		["m2"] = { default = 0 },
		["m2h"] = { default = 0 },
		["m3"] = { default = 0 },
		["m3h"] = { default = 0 },
		["m4"] = { default = 0 },
		["m4h"] = { default = 0 },
		["em"] = { default = 0 },
		["emun"] = { default = 0 },
		["jh"] = { default = 0 },
		["jhh"] = { default = 0 },
		["ref"] = { default = 0 },
	}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local ety_table = {
		["header"] = [=[ 
		{| class="mw-collapsible mw-collapsed wikitable" style="width:60%; background-color:#f8f9fa;"
		|-
		! colspan="3" style="text-align:center" | Sejarah Pembacaan
		|-
		]=],

		["dongguk"] = [=[
		| colspan="3" style="text-align:center; background-color:#eaecf0;" | <span class="explain" title="A system of somewhat artificial readings that had sought to capture traditional phonetic distinctions of Middle Chinese which were often unrealistic in Korean—fell out of use after the 1480s."><b>Dongguk Jeongun Reading</b></span>
		|-
		| colspan="1" style="text-align:center; background-color:#ffffff;" | <i>Dongguk Jeongun</i>, 1448 || colspan="2" style="text-align:center; background-color:#ffffff; min-width:65%;" | ]=] .. args["dk"] ..'',
	
		["middle_header"] = [=[
		| colspan="3" style="text-align:center; background-color:#eaecf0;" | <b>Korea Pertengahan</b>
        |-
		| colspan="1" rowspan="2" style="text-align:center; background-color:#f8f9fa;" | <b>Text</b> || colspan="2" style="text-align:center; background-color:#f8f9fa; min-width:65%;" | <b>[[음훈|Eumhun]]</b>
        |-
        | colspan="1" style="text-align:center; background-color:#f8f9fa;" | <b>Gloss (<i>hun</i>)</b> || colspan="1" style="text-align:center; background-color:#f8f9fa; min-width:25%;" | <b>Reading</b> 
        ]=],
        
        ["middle_1"] = [=[
        | style="text-align:center; background-color:#ffffff;" | <i>Hunmong Jahoe</i>, 1527<sup>[https://ko.wikisource.org/wiki/%ED%9B%88%EB%AA%BD%EC%9E%90%ED%9A%8C/]=] .. args["ml"] ..  [=[]</sup> || style="text-align:center; background-color:#ffffff;" | ]=] .. args["mh"] .. [=[ || style="text-align:center; background-color:#ffffff;" | ]=] .. args["m"] ..'',

		["middle_2"] = [=[
		| style="text-align:center; background-color:#ffffff;" | <i>Gwangju Cheonjamun</i>, 1575 || style="text-align:center; background-color:#ffffff;" | ]=] .. args["m2h"] .. [=[ || style="text-align:center; background-color:#ffffff;" | ]=] .. args["m2"] ..'',

		["middle_3"] = [=[
		| style="text-align:center; background-color:#ffffff;" | <i>Sinjeung Yuhap</i>, 1576 || style="text-align:center; background-color:#ffffff;" | ]=] .. args["m3h"] .. [=[ || style="text-align:center; background-color:#ffffff;" | ]=] .. args["m3"] ..'',

		["middle_4"] = [=[
		| style="text-align:center; background-color:#ffffff;" | <i>Seokbong Cheonjamun</i>, 1583 || style="text-align:center; background-color:#ffffff;" | ]=] .. args["m4h"] .. [=[ || style="text-align:center; background-color:#ffffff;" | ]=] .. args["m4"] ..'',

		["early"] = [=[
		| colspan="3" style="text-align:center; background-color:#eaecf0;" | <span class="explain" title="The Korean language from the beginning of the seventeenth century to the end of the nineteenth century."><b>Korea Moden Awal</b></span>
		|-
		| style="text-align:center; background-color:#f8f9fa; min-width:30%;" | <b>Text</b> || colspan="1" style="text-align:center; background-color:#f8f9fa;" | <b>Final (韻)</b> || colspan="1" style="text-align:center; background-color:#f8f9fa; min-width:25%;" | <b>Reading</b>
        |-
		| style="text-align:center; background-color:#ffffff;" | <i>Samun Seonghwi</i>, 1751 || style="text-align:center; background-color:#ffffff;" | ]=] .. args["emun"] .. [=[ || style="text-align:center; background-color:#ffffff;" | ]=] .. args["em"] ..'',

		["juhae"] = [=[
		| colspan="3" style="text-align:center; background-color:#eaecf0;" | <span class="explain" title="The Korean language from the beginning of the seventeenth century to the end of the nineteenth century."><b>Korea Moden Awal</b></span>
		|-
		| rowspan="2" style="text-align:center; background-color:#f8f9fa;" | <b>Text</b> || colspan="2" style="text-align:center; background-color:#f8f9fa; min-width:65%;" | <b>[[음훈|Eumhun]]</b>
        |-
        | colspan="1" style="text-align:center; background-color:#f8f9fa;" | <b>Gloss (<i>hun</i>)</b> || colspan="1" style="text-align:center; background-color:#f8f9fa; min-width:25%;" | <b>Reading</b>
		|-
		| style="text-align:center; background-color:#ffffff;" | <i>Juhae Cheonjamun</i>, 1804 || style="text-align:center; background-color:#ffffff;" | ]=] .. args["jhh"] .. [=[ || style="text-align:center; background-color:#ffffff;" | ]=] .. args["jh"] ..'',

		["reference"] = [=[
		| colspan="3" style="background-color:#f8f9fa"  | ]=] .. args["ref"],
	
		["midstop"] = [=[
		
		|- 
	
		]=],
		
		["endstop"] = [=[ 
		|}]=],
	}
	
	if args["dk"] ~= 0 then
	else ety_table.dongguk = ''
	end
	
	if args["m"] ~= 0 then
		elseif args["m2"] ~= 0 then
			elseif args["m3"] ~= 0 then
				elseif args["m4"] ~= 0 then
	else ety_table.middle_header = ''
	end

	if args["m"] ~= 0 then
	else ety_table.middle_1 = ''
	end
		
	if args["m2"] ~= 0 then
	else ety_table.middle_2 = ''
	end
	
	if args["m3"] ~= 0 then
	else ety_table.middle_3 = ''
	end
	
	if args["m4"] ~= 0 then
	else ety_table.middle_4 = ''
	end
	
	if args["em"] ~= 0 then
	else ety_table.early = ''
	end
	
	if args["jh"] ~= 0 then
	else ety_table.juhae = ''
	end
	
	if args["ref"] ~= 0 then
	else ety_table.reference = ''
	end
	
	local main_table = ety_table.header ..
					   ety_table.dongguk ..
					   ety_table.midstop ..
					   ety_table.middle_header..
					   ety_table.midstop ..
					   ety_table.middle_1 ..
					   ety_table.midstop ..
					   ety_table.middle_2 ..
					   ety_table.midstop ..
					   ety_table.middle_3 ..
					   ety_table.midstop ..
					   ety_table.middle_4 ..
					   ety_table.midstop ..
					   ety_table.early ..
					   ety_table.midstop ..
					   ety_table.juhae ..
					   ety_table.midstop ..
					   ety_table.reference ..
					   ety_table.endstop
					   
	return main_table
end

return export