Jump to content

Module:accel/en

From Wiktionary, the free dictionary

This module contains new entry creation rules for English; see WT:ACCEL for an overview, and Module:accel for information on creating new rules.


return {generate = function(params, entry)
	if params.form == "comparative" or params.form == "superlative" then
		-- [[Template:en-comparative of]], [[Template:en-superlative of]]
		entry.def = "{{en-" .. params.form .. " of|" .. params.origin
			.. (params.pos ~= "adjective" and "|POS=" .. params.pos or "")
			.. "}}"
	else
		if params.form == "pres|part" then
			entry.pos_header = "Verb"
			params.pos = "verb"
		end
		local heads = {}
		local non_default_head = false
		for _, target in ipairs(params.targets) do
			if target.term ~= params.target_pagename then
				non_default_head = true
				table.insert(heads, target.term)
			else
				table.insert(heads, "+")
			end
		end
		if non_default_head then
			heads = "|head=" .. table.concat(heads, ",")
		else
			heads = ""
		end
		entry.head = "{{en-head|" .. params.pos .. "f" .. heads .. "}}"
	end
end}