Module:descendants

Από Βικιλεξικό
Μετάβαση στην πλοήγηση Πήδηση στην αναζήτηση

>> Module:descendants >> Module:descendants/τεκμηρίωση (documentation)

Το Module:descendants καλείται από το Πρότυπο:απόγ. Για τις γλώσσες χρησιμοποιείται το Module:Languages.

-- descendants 2020.04.07. Sarri.greek
-- Invoked by [[Πρότυπο:απόγ]] (απόγονοι)
-- the arrows should have exactly the same width.
-- 2023.01.01. links to word & font-size are similar to [[Module:Πρότυπο:λ]]
-- TO DO: if lang_iso == nil then warning

local export = {}

local languages = mw.loadData("Module:Languages")

export.main = function(frame)
	myarg = frame:getParent().args --  for Template only
	

local get_symbol = myarg['symb'] or myarg['σύμβολο'] or ''
if get_symbol ~= '' and get_symbol ~=  nil then
	if get_symbol == 'inh' or get_symbol == 'κλη' then return
'<span style="font-family:Courier New; font-size:1.5em; line-height:0.3em; color:#999999;" title="κληρονομημένο - inherited">&rArr;</span>'
	elseif get_symbol == 'bor' or get_symbol == 'δαν' then return
'<span style="font-family:Courier New; font-size:1.5em; line-height:0.3em; color:#999999;" title="δάνειο ή είδος δανεισμού - borrowing">&#x21b7;</span>'
	elseif get_symbol == 'lbor' or get_symbol == 'λδαν' then return
'<span style="font-family:Courier New; font-size:1.5em; line-height:0.3em; color:#999999;" title="λόγιο δάνειο - learned borrowing">&#x21B4;</span>'
	elseif get_symbol == 'dlbor' or get_symbol == 'λδδ' then return
'<span style="font-family:Courier New; font-size:1.5em; line-height:0.3em; color:#999999;" title="λόγιος διαχρονικός δανεισμός - learned internal borrowing">&#x21d8;</span>'
	elseif get_symbol == 'der' or get_symbol == 'etym' or get_symbol == 'ετυμ' then return
'<span style="font-family:Courier New; font-size:2.0em; line-height:0.3em; color:#999999;" title="προέλευση - origin">&rarr;</span>'
	end
else
		
-- full function:
	
	local lang_iso = myarg[1] or ''
		if lang_iso == '' or lang_iso == nil then
		return '<span style="color:#b22222;">Κάποια παράμετρος λείπει ή δεν υπάρχει ο κωδικός iso γλώσσας! - A parameter or the language-code is missing!</span>'
		end
	local lang = languages[lang_iso]['name'] or ''
	local lang_link = languages[lang_iso]['link'] or ''
	local word = myarg[2] or ''
		-- for word = '-' see bolow
		if word == '' or word == nil then
		return '<span style="color:#b22222;">Κάποια παράμετρος λείπει! - A parameter is missing!</span>'
		end
	local kind = myarg[3] or ''
		if word == '1' then kind = '1' end
		if kind == '' or kind == nil then
		return '<span style="color:#b22222;">Λείπει η παράμετρος για το είδος της σχέσης - Please add the kind of etymological relationship!</span>'
		end
	local mytext = {}

	if lang_iso ~= '' and lang_iso ~= nil then
		lang_iso = lang
	end
	if kind == '1' then kind = '' -- for source
elseif kind == 'κλη' then kind = '<span style="font-family:Courier New; font-size:1.5em; line-height:0.3em; color:#999999;" title="κληρονομημένο - inherited">&rArr;</span>'
elseif kind == 'inh' then kind = '<span style="font-family:Courier New; font-size:1.5em; line-height:0.3em; color:#999999;" title="κληρονομημένο - inherited">&rArr;</span>'

elseif kind == 'λδδ' then kind = '<span style="font-family:Courier New; font-size:1.5em; line-height:0.3em; color:#999999;" title="λόγιος διαχρονικός δανεισμός - learned internal borrowing">&#x21d8;</span>'
elseif kind == 'αναβ' then kind = '<span style="font-family:Courier New; font-size:1.5em; line-height:0.3em; color:#999999;" title="λόγιος διαχρονικός δανεισμός - learned internal borrowing">&#x21d8;</span>'
elseif kind == 'dlbor' then kind = '<span style="font-family:Courier New; font-size:1.5em; line-height:0.3em; color:#999999;" title="λόγιος διαχρονικός δανεισμός - learned internal borrowing">&#x21d8;</span>'

elseif kind == 'δαν' then kind = '<span style="font-family:Courier New; font-size:1.5em; line-height:0.3em; color:#999999;" title="δάνειο ή είδος δανεισμού - borrowing">&#x21b7;</span>'
elseif kind == 'bor' then kind = '<span style="font-family:Courier New; font-size:1.5em; line-height:0.3em; color:#999999;" title="δάνειο ή είδος δανεισμού - borrowing">&#x21b7;</span>'

elseif kind == 'λδαν' then kind = '<span style="font-family:Courier New; font-size:1.5em; line-height:0.3em; color:#999999;" title="λόγιο δάνειο - learned borrowing">&#x21B4;</span>'
elseif kind == 'lbor' then kind = '<span style="font-family:Courier New; font-size:1.5em; line-height:0.3em; color:#999999;" title="λόγιο δάνειο - learned borrowing">&#x21B4;</span>'

elseif kind == 'ετυμ' then kind = '<span style="font-family:Courier New; font-size:2.0em; line-height:0.3em; color:#999999;" title="προέλευση - origin">&rarr;</span>'
elseif kind == 'etym' then kind = '<span style="font-family:Courier New; font-size:2.0em; line-height:0.3em; color:#999999;" title="προέλευση - origin">&rarr;</span>'
elseif kind == 'der' then kind = '<span style="font-family:Courier New; font-size:2.0em; line-height:0.3em; color:#999999;" title="προέλευση - origin">&rarr;</span>'
	else
	kind = '<span style="color:#b22222;">Η παράμετρος για το είδος της σχέσης χρειάζεται διόρθωση - Please correct the kind of etymological relationship!</span>'
	end


-- the word link ==========================
	if word == '-' or word == '0' then word = '&nbsp;' end 
		-- Cannot word = '' Need to put something. check latin [[stilus]]
		-- see below at kind
	if word ~= '1' and word ~= '-' and word ~= nil then
		show_word = myarg['εμφ'] or myarg['alt'] or myarg['show'] or ''
		if show_word ~= '' then 
			-- as in [[Module:Πρότυπο:λ]]
			lang_iso = myarg[1] or ''
			-- check [[φιλοσοφία]] [[شادروان]]
			if languages[lang_iso]['script'] == 'Arab' -- ar, fa, ota, ps, ur
			then
				word = '[[' .. word .. '#' .. lang_link .. '|<span style="font-size:140%; line-height:1em;">' .. show_word .. '</span>]]'
			elseif languages[lang_iso]['script'] == 'Hani' -- zh, ja (for both Han characters kanji & Kata (katakana))
			then
				word = '[[' .. word .. '#' .. lang_link .. '|<span style="font-size:115%; line-height:1em;">' .. show_word .. '</span>]]'
			else
				word = '[[' .. word .. '#' .. lang_link .. '|' .. show_word .. '</span>]]'
			end	
		else -- if no show_word
			-- as in [[Module:Πρότυπο:λ]]
			lang_iso = myarg[1] or ''
			-- check [[φιλοσοφία]] [[شادروان]]
			if languages[lang_iso]['script'] == 'Arab' -- ar, fa, ota, ps, ur
			then
				word = '[[' .. word .. '#' .. lang_link .. '|<span style="font-size:140%; line-height:1em;">' .. word .. '</span>]]'
			elseif languages[lang_iso]['script'] == 'Hani' -- zh, ja (for both Han characters kanji & Kata (katakana))
			then
				word = '[[' .. word .. '#' .. lang_link .. '|<span style="font-size:115%; line-height:1em;">' .. word .. '</span>]]'
			else
				word = '[[' .. word .. '#' .. lang_link .. '|' .. word .. '</span>]]'
			end	
		end
	end
	
-- transliteration
	transliteration = myarg['γ'] or myarg['tr'] or ''
	if transliteration ~= '' then transliteration = ' (<span style="font-size:95%; letter-spacing:1px;">' .. transliteration .. '</span>)' end

-- word=1 the donor word
	if word == '1' then
		show_word = myarg['εμφ'] or myarg['alt'] or myarg['show'] or ''
		if show_word ~= '' then 
			-- as in [[Module:Πρότυπο:λ]]
			lang_iso = myarg[1] or ''
			-- check [[قهوة]] (qahwah)
			if languages[lang_iso]['script'] == 'Arab' -- ar, fa, ota, ps, ur
			then
				word = '<span style="font-size:140%; line-height:1em;"><b>' .. show_word .. '</b></span>'
			elseif languages[lang_iso]['script'] == 'Hani' -- zh, ja (for both Han characters kanji & Kata (katakana))
			then
					word = '<span style="font-size:115%; line-height:1em;"><b>' .. show_word .. '</b></span>'
			else
				word = '<b>' .. show_word .. '</b>'
			end
		else -- no show_word
			-- as in [[Module:Πρότυπο:λ]]
			lang_iso = myarg[1] or ''
			-- check [[شادروان]] 
			if languages[lang_iso]['script'] == 'Arab' -- ar, fa, ota, ps, ur
			then
				word = '<span style="font-size:140%; line-height:1em;"><b>' .. mw.title.getCurrentTitle().text .. '</b></span>'
			elseif languages[lang_iso]['script'] == 'Hani' -- zh, ja (for both Han characters kanji & Kata (katakana))
			then
				word = '<span style="font-size:115%; line-height:1em;"><b>' .. mw.title.getCurrentTitle().text .. '</b></span>'
			else
				word = '<b>' .. mw.title.getCurrentTitle().text .. '</b>'
			end
		end -- close if show_word
		
		return word .. transliteration .. ' ' .. "([[" .. lang .. '|<span style="color:#002000; border-bottom: 1px dashed #ddd; font-style:italic;">' .. lang .. '</span>]])'
	end
	
	if (lang_iso ~= '' and lang_iso ~= nil) 
	and (word ~= '' and word ~= nil) 
	and (kind ~= '' and kind ~= nil) and kind ~= '1' then
		kind = kind .. ' ' .. "[[" .. lang .. '|<span style="color:#002000; border-bottom: 1px dashed #ddd; font-style:italic;">' .. lang .. '</span>]]'
		
		if myarg[2] == '-'or myarg[2] == '0' then kind = kind else kind = kind .. ': ' ..  word .. transliteration end
				-- check [[stilus]]
				-- cannot write if word == '-'
		return kind
	end	
	
end -- close get_symbol

end -- close main function

return export