Jump to content

Module:User:Babr/fa-conj

From Wiktionary, the free dictionary

Conjugation of کردن
THE TABLE WORKS!

local export = {}

local lang = require("Module:languages").getByCode("fa")
--local m_table = require("Module:table")
--local m_links = require("Module:links")
local m_string_utilities = require("Module:string utilities")
--local m_script_utilities = require("Module:script utilities")
--local iut = require("Module:inflection utilities")
--local m_para = require("Module:parameters")
local m_translit = require("Module:fa-cls-translit")
local gsub = m_string_utilities.sub

-- other tools
local u = require("Module:string/char")

-- mixing latin and Arabic in lua is annoying
local alif = u(0x0627)
local ye = u(0x06cc)
local he = u(0x0647)
local noon = u(0x0646)
local meem = u(0x0645)
local daal = u(0x062F)
-- diacritics
local ZWNJ = u(0x200c)
local zabar = u(0x064e)
local zer = u(0x0650)
local pesh = u(0x064f)
local sukuun = u(0x0652)
-- local tashdiid = u(0x0651)
-- prefixs
local PRES = meem .. ye
-- suffixes 
local first_pl = ye .. meem
local second_pl = ye .. daal
local third_pl = zabar .. noon .. daal
local second_sg = zer .. ye
local first_sg = zabar .. meem
local third_sg = zabar .. daal

-- colloquial (Dari)
local colloq_first_sg = pesh .. noon
local colloq_third_sg = zabar .. he
local colloq_second_pl = ye .. noon

local function get_stylesheet()
	return require("Module:TemplateStyles")("Module:User:Babr/fa-conj/style.css")
end

local res = ""
	if count == 0 then
		cols = "100%"
		rows = 1
	end
	
function export.show(frame)
	local args = frame:getParent().args
	local full_verb = args[1] or mw.title.getCurrentTitle().text
	local word = args[1] or mw.title.getCurrentTitle().text
	if word == 'fa_conj' or word == 'fa-conj' then word =  'کَرْدَن' end

	local res = {'{| class="inflection-table vsSwitcher autocollapsed fa-table-title"' }
	table.insert(res, '! class="vsToggleElement" colspan=\"8\" | Conjugation of <i>' .. full_verb .. '</i>' )
	table.insert(res, '|- class="vsHide"')
	table.insert(res, '| class="fa-conj-roots" | THE TABLE WORKS!')
	table.insert(res, '|}')
	return table.concat(res, "\n") .. get_stylesheet()
	end

--[=[local function make_table(alternant_multiword_spec)

local table_spec_personal = [=[
{\op}| class="inflection-table vsSwitcher autocollapsed"
! class="vsToggleElement" colspan="8" | Conjugation of ''{{PAGENAME}}''
|- class="vsHide"
! colspan="3" class="fa-conj-roots" | infinitive
| colspan="5" | 
|- class="vsHide"
! rowspan="2" class="fa-conj-roots" | stem 
! colspan="2" class="fa-conj-roots" | past
| colspan="5" | {past-stem}
|- class="vsHide"
! colspan="2" class="fa-conj-roots" | present
| colspan="5"| {pres-stem}
|- class="vsHide"
! rowspan="2" class="fa-conj-roots" | participle 
! colspan="2" class="fa-conj-roots" | past
| colspan="5"| {past-participle}
|- class="vsHide"
! colspan="2" class="fa-conj-roots" | present
| colspan="5" | {pres-participle}
|- class="vsHide"
! colspan="2" rowspan="2" class="fa-conj-person" | person</br>{{lang|fa|شخص}}
! colspan="3" class="fa-conj-person" | singular</br>{{l|fa|مفرد}}
! colspan="3" class="fa-conj-person" | plural</br>{{l|fa|جمع}}
|- class="vsHide"
! class="fa-conj-person" | 1<sup><small>st</small></sup></br>{{lang|fa|اول}}
! class="fa-conj-person" | 2<sup><small>nd</small></sup></br>{{lang|fa|دوم}}
! class="fa-conj-person" | 3<sup><small>rd</small></sup></br>{{lang|fa|سوم}}
! class="fa-conj-person" | 1<sup><small>st</small></sup></br>{{lang|fa|اول}}
! class="fa-conj-person" | 2<sup><small>nd</small></sup></br>{{lang|fa|دوم}}
! class="fa-conj-person" | 3<sup><small>rd</small></sup></br>{{lang|fa|سوم}}
|- class="vsHide"
<!--



past tense forms


-->! rowspan="6" class="fa-conj-past-group" | past</br>{{lang|fa|گذشته}}
! class="fa-conj-past-group" colspan="1" | 
! class="fa-conj-past-group" | {{l|fa|{{{1s-pronoun|من}}}}}
! class="fa-conj-past-group" | {{l|fa|تو}}
! class="fa-conj-past-group" | {{l|fa|او}}
! class="fa-conj-past-group" | {{l|fa|ما}}
! class="fa-conj-past-group" | {{l|fa|شما}}
! class="fa-conj-past-group" | {{l|fa|{{{3s-pronoun|[[ایشان]]، [[آن‌ها]]}}}}}
|- class="vsHide"
! class="fa-conj-past-group" | simple</br>{{lang|fa|ساده}}
| {1s-past-simp}
| {2s-past-simp}
| {3s-past-simp}
| {1p-past-simp}
| {2p-past-simp}
| {3p-past-simp}
|- class="vsHide"
! class="fa-conj-past-group" | imperfect</br>{{lang|fa|ناکامل}}
| {1s-past-imp}
| {2s-past-imp}
| {3s-past-imp}
| {1p-past-imp}
| {2p-past-imp}
| {3p-past-imp}
|- class="vsHide"
! class="fa-conj-past-group" | perfect</br>{{lang|fa|کامل}}
| {1s-past-per}
| {2s-past-per}
| {3s-past-per}
| {1p-past-per}
| {2p-past-per}
| {3p-past-per}
|- class="vsHide"
! class="fa-conj-past-group" | subjunctive</br>{{lang|fa|شرطی}}
| {1s-past-sub}
| {2s-past-sub}
| {3s-past-sub}
| {1p-past-sub}
| {2p-past-sub}
| {3p-past-sub}
|- class="vsHide"
! class="fa-conj-past-group" | progressive</br>{{lang|fa|استمراری}}
| {1s-past-pro}
| {2s-past-pro}
| {3s-past-pro}
| {1p-past-pro}
| {2p-past-pro}
| {3p-past-pro}
|- class="vsHide"
<!--




Present tense forms

-->! rowspan="6" class="fa-conj-present-group" | present</br>{{lang|fa|حال}}
! class="fa-conj-present-group" | 
! class="fa-conj-present-group" | {{l|fa|{{{1s-pronoun|من}}}}}
! class="fa-conj-present-group" | {{l|fa|تو}}
! class="fa-conj-present-group" | {{l|fa|او}}
! class="fa-conj-present-group" | {{l|fa|ما}}
! class="fa-conj-present-group" | {{l|fa|شما}}
! class="fa-conj-present-group" | {{l|fa|{{{3s-pronoun|[[ایشان]]، [[آن‌ها]]}}}}}
|- class="vsHide"
! class="fa-conj-present-group" | simple</br>{{lang|fa|ساده}}
| {1s-pres-simp}
| {2s-pres-simp}
| {3s-pres-simp}
| {1p-pres-simp}
| {2p-pres-simp}
| {3p-pres-simp}
|- class="vsHide"
! class="fa-conj-present-group" | imperfect</br>{{lang|fa|ناکامل}}
| {1s-pres-imp}
| {2s-pres-imp}
| {3s-pres-imp}
| {1p-pres-imp}
| {2p-pres-imp}
| {3p-pres-imp}
|- class="vsHide"
! class="fa-conj-present-group" | perfect</br>{{lang|fa|کامل}}
| {1s-pres-per}
| {2s-pres-per}
| {3s-pres-per}
| {1p-pres-per}
| {2p-pres-per}
| {3p-pres-per}
|- class="vsHide"
! class="fa-conj-present-group" | subjunctive</br>{{lang|fa|شرطی}}
| {1s-pres-sub}
| {2s-pres-sub}
| {3s-pres-sub}
| {1p-pres-sub}
| {2p-pres-sub}
| {3p-pres-sub}
|- class="vsHide"
! class="fa-conj-present-group" | progressive</br>{{lang|fa|استمراری}}
| {1s-pres-pro}
| {2s-pres-pro}
| {3s-pres-pro}
| {1p-pres-pro}
| {2p-pres-pro}
| {3p-pres-pro}
|- class="vsHide"<!--



Future and Imperative forms -->
! rowspan="2" colspan="2" class="fa-conj-future-group" {{!}} future</br>{{lang|fa|آینده}}
! class="fa-conj-future-group" {{!}} {{l|fa|{{{1s-pronoun|من}}}}}
! class="fa-conj-future-group" {{!}} {{l|fa|تو}}
! class="fa-conj-future-group" {{!}} {{l|fa|او}}
! class="fa-conj-future-group" {{!}} {{l|fa|ما}}
! class="fa-conj-future-group" {{!}} {{l|fa|شما}}
! class="fa-conj-future-group" {{!}} {{l|fa|{{{3s-pronoun|[[ایشان]]، [[آن‌ها]]}}}}}
|- class="vsHide"
| {1s-future}
| {2s-future}
| {3s-future}
| {1p-future}
| {2p-future}
| {3p-future}
|- class="vsHide"
! rowspan="3"; class="fa-conj-imperative-group" | imperative</br>{{lang|fa|دستوری}}
! style="background:#e4c0c0; color:#000000" |
! colspan="3"; class="fa-conj-imperative-group" | {{l|fa|تو}}
! colspan="3"; class="fa-conj-imperative-group" | {{l|fa|شما}}
|-class="vsHide"
! class="fa-conj-imperative-group" | authoritative</br>{{lang|fa|امر}}
| colspan="3"| {2s-imperative}
| colspan="3"| {2p-imperative}
|-class="vsHide"
! class="fa-conj-imperative-group" | prohibitive</br>{{lang|fa|نهی}}
| colspan="3"| {2s-imperative-neg}
| colspan="3"| {2p-imperative-neg}
|{\cl}]==]
	local formatted_table_pers = m_string_utilities.format(table_spec_personal, forms) 
	return require("Module:TemplateStyles")("Module:User:Babr/fa-conj/frame/style.css") .. formatted_table_pers
end]=]

--[=[function export.show(frame)
	return make_table( alternant_multiword_spec ) .. require( "Module:utilities" ).format_categories( alternant_multiword_spec.categories, lang )
end]=]

return export