Modul:accel/sl

A Wikiszótárból, a nyitott szótárból

A modult a Modul:accel/sl/doc lapon tudod dokumentálni

return {generate = function (params, entry)
	if params.form == 'comparative' or params.form == 'superlative' then
		entry.pronunc = '{{rfp|lang=sl}}'
		entry.head = '{{sl-' .. (params.pos == 'adverb' and 'adv' or 'adj') .. '-'
			.. (params.form == 'comparative' and 'comp' or 'sup') .. '|' .. params.target .. '}}'
		
		-- If there is a comma in the head, assume it has multiple accented variants.
		-- Add a link with an alternative display form instead.
		entry.def =
			'{{' .. params.form .. ' of|sl|' ..
			(params.pos ~= 'adjective' and '|POS=' .. params.pos or '') ..
			(not params.origin:find(',') and '|' .. params.origin_pagename or '') ..
			'|' .. params.origin .. '}}'

		-- If it's an adjective, add a declension table
		if params.pos == 'adjective' then
			local stem = params.target:sub(1, -1)
			local ending = params.target:sub(-1)
			
			-- Adjective comparatives and superlatives must always end in -i
			if ending ~= 'i' then
				return error('The Slovene comparative/superlative "' .. params.target .. '" does not end in -i.')
			end
			entry.declension = '{{sl-decl-adj|' .. stem .. '|def=1}}'
		end
	else
		no_rule_error(params)
	end
end}