Module:ug-noun

From Wiktionary, the free dictionary
Jump to navigation Jump to search
This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local export = {}

function export.make_table(data)
	local colors = {
		top = "#F0F0F0", gray = "#C0C0C0", straw = "#e2e4c0", blue = "#c0cfe4",
		gray_text = "#7f7f7f", green = "#c0e4c0",  tan = "#e4d4c0",
	}
	
	local result = {}

	--header
	table.insert(result,
[=[
<div class="NavFrame" style="clear:both">
<div class="NavHead" align=left>Declension of {{{imp_nom_s}}} ''(see also [[Appendix:Uyghur nouns]])''</div>
<div class="NavContent" align=center>
{| style="background:{{{top}}};width:100%;"
]=])

	--decl
	table.insert(result, export.make_case("impersonal","imp","straw"))
	table.insert(result, export.make_case("1<sup>st</sup> person singular (my)","p1s","blue"))
	table.insert(result, export.make_case("1<sup>st</sup> person plural (our)","p1p","green"))
	table.insert(result, export.make_case("2<sup>nd</sup>person singular ordinary (your)","p2so","tan"))
	table.insert(result, export.make_case("2<sup>nd</sup>person plural ordinary (your)","p2po","blue"))
	table.insert(result, export.make_case("2<sup>nd</sup>person singular refined (your)","p2sr","green"))
	table.insert(result, export.make_case("2<sup>nd</sup>person plural refined (your)","p2pr","tan"))
	table.insert(result, export.make_case("2<sup>nd</sup>person singular & plural respectful (your)","p2spr","blue"))
	table.insert(result, export.make_case("3<sup>rd</sup> person (his, her, its, their)","p3","green"))
	
	--footer
	table.insert(result,
[=[
|}
</div>
</div>
]=])
	
	local str,_ = mw.ustring.gsub(table.concat(result), "{{{([^}]+)}}}",
		function(code)
			return data.forms[code] or colors[code] or ""
		end)
	return str
end

function export.make_case(title,short,color)

	local case = [=[
|-
! rowspan="14" style="background:{{{straw}}}" | impersonal

! style="background:{{{straw}}};width:10%" | 
! style="background:{{{straw}}};width:40%" | singular
! style="background:{{{straw}}};width:40%" | plural

|-
! style="height:3em;background:#ECECEC" | nominative
| {{{imp_nom_s}}}
| {{{imp_nom_p}}}

|-
! style="height:3em;background:#ECECEC" | genitive
| {{{imp_gen_s}}}
| {{{imp_gen_p}}}

|-
! style="height:3em;background:#ECECEC" | accusative
| {{{imp_acc_s}}}
| {{{imp_acc_p}}}

|-
! style="height:3em;background:#ECECEC" | dative
| {{{imp_dat_s}}}
| {{{imp_dat_p}}}

|-
! style="height:3em;background:#ECECEC" | locative
| {{{imp_loc_s}}}
| {{{imp_loc_p}}}

|-
! style="height:3em;background:#ECECEC" | ablative
| {{{imp_abl_s}}}
| {{{imp_abl_p}}}

|-
! rowspan="2" style="height:3em;background:#ECECEC" | locative-qualitative
| {{{imp_lqu_s}}}
| {{{imp_lqu_p}}}

|-
! colspan="2" style="height:3em;background:#ECECEC" | 

<div class="NavFrame">
<div class="NavHead" align=center>Declension of locative-qualitative form </div>
<div class="NavContent">
{| style="background:#ECECEC;text-align:center;width:100%"

|-

! style="background:#ECECEC;width:10%" | 
! style="background:#ECECEC;width:45%" | singular
! style="background:#ECECEC;width:45%" | plural

|-
! style="height:3em;background:#ECECEC" | nominative
| {{{imp_lqu_nom_s}}}
| {{{imp_lqu_nom_p}}}

|-
! style="height:3em;background:#ECECEC" | genitive
| {{{imp_lqu_gen_s}}}
| {{{imp_lqu_gen_p}}}

|-
! style="height:3em;background:#ECECEC" | accusative
| {{{imp_lqu_acc_s}}}
| {{{imp_lqu_acc_p}}}

|-
! style="height:3em;background:#ECECEC" | dative
| {{{imp_lqu_dat_s}}}
| {{{imp_lqu_dat_p}}}

|-
! style="height:3em;background:#ECECEC" | locative
| {{{imp_lqu_loc_s}}}
| {{{imp_lqu_loc_p}}}

|-
! style="height:3em;background:#ECECEC" | ablative
| {{{imp_lqu_abl_s}}}
| {{{imp_lqu_abl_p}}}

|-
! style="height:3em;background:#ECECEC" | locative-qualitative
| {{{imp_lqu_lqu_s}}}
| {{{imp_lqu_lqu_p}}}

|-
! style="height:3em;background:#ECECEC" | limitative
| {{{imp_lqu_lim_s}}}
| {{{imp_lqu_lim_p}}}

|-
! style="height:3em;background:#ECECEC" | similitude
| {{{imp_lqu_sem_s}}}
| {{{imp_lqu_sem_p}}}

|-
! style="height:3em;background:#ECECEC" | equivalence
| {{{imp_lqu_com_s}}}
| {{{imp_lqu_com_p}}}
|}
</div></div>

|-
! style="height:3em;background:#ECECEC" | limitative
| {{{imp_lim_s}}}
| {{{imp_lim_p}}}

|-
! style="height:3em;background:#ECECEC" | similitude
| {{{imp_sem_s}}}
| {{{imp_sem_p}}}

|-
! style="height:3em;background:#ECECEC" | equivalence
| {{{imp_com_s}}}
| {{{imp_com_p}}}

|-
! rowspan="2" style="height:3em;background:#ECECEC" | representative
| {{{imp_rep_s}}}
| {{{imp_rep_p}}}

|-
! colspan="2" style="height:3em;background:#ECECEC" | 

<div class="NavFrame">
<div class="NavHead" align=center>Declension of representative form </div>
<div class="NavContent">
{| style="background:#ECECEC;text-align:center;width:100%"

|-

! style="background:#ECECEC;width:10%" | 
! style="background:#ECECEC;width:45%" | singular
! style="background:#ECECEC;width:45%" | plural

|-
! style="height:3em;background:#ECECEC" | nominative
| {{{imp_rep_nom_s}}}
| {{{imp_rep_nom_p}}}

|-
! style="height:3em;background:#ECECEC" | genitive
| {{{imp_rep_gen_s}}}
| {{{imp_rep_gen_p}}}

|-
! style="height:3em;background:#ECECEC" | accusative
| {{{imp_rep_acc_s}}}
| {{{imp_rep_acc_p}}}

|-
! style="height:3em;background:#ECECEC" | dative
| {{{imp_rep_dat_s}}}
| {{{imp_rep_dat_p}}}

|-
! style="height:3em;background:#ECECEC" | locative
| {{{imp_rep_loc_s}}}
| {{{imp_rep_loc_p}}}

|-
! style="height:3em;background:#ECECEC" | ablative
| {{{imp_rep_abl_s}}}
| {{{imp_rep_abl_p}}}

|-
! style="height:3em;background:#ECECEC" | locative-qualitative
| {{{imp_rep_lqu_s}}}
| {{{imp_rep_lqu_p}}}

|-
! style="height:3em;background:#ECECEC" | limitative
| {{{imp_rep_lim_s}}}
| {{{imp_rep_lim_p}}}

|-
! style="height:3em;background:#ECECEC" | similitude
| {{{imp_rep_sem_s}}}
| {{{imp_rep_sem_p}}}

|-
! style="height:3em;background:#ECECEC" | equivalence
| {{{imp_rep_com_s}}}
| {{{imp_rep_com_p}}}
|}
</div></div>
]=]
	if title ~= "" then case = string.gsub(case,"impersonal",title) end
	if short ~= "" then case = string.gsub(case,"imp_",short .. "_") end
	if color ~= "" then case = string.gsub(case,"straw",color) end
	
	return case
end

return export