Module:inherit: Difference between revisions

From Laenkea
Jump to navigation Jump to search
(Created page with "local export = {} local get_by_code = require("Module:languages").get_by_code local make_link = require("Module:links").make_link function export.show(frame) local args = (frame:getParent() and frame:getParent().args) or frame.args local lang = get_by_code(args[1]) local origin = get_by_code(args[2]) local category = "" if not args["nocat"] then category = "Category:" .. lang.name .. " terms inherited from " .. origin.name .. "" end return make_link{ ["li...")
 
No edit summary
Line 15: Line 15:
["code"] = origin.code,
["code"] = origin.code,
["word"] = args[3],
["word"] = args[3],
["display"] = args["d"] or args["display"],
["display"] = args[4] or args["d"] or args["display"],
["text"] = args[4] or args["t"] or args["text"],
["text"] = args[5] or args["t"] or args["text"],
["pos"] = args["pos"]
["pos"] = args["pos"]
} .. category
} .. category

Revision as of 21:20, 5 August 2023

Documentation for this module may be created at Module:inherit/documentation

local export = {}
local get_by_code = require("Module:languages").get_by_code
local make_link = require("Module:links").make_link

function export.show(frame)
	local args = (frame:getParent() and frame:getParent().args) or frame.args
	local lang = get_by_code(args[1])
	local origin = get_by_code(args[2])
	local category = ""
	if not args["nocat"] then
		category = "[[Category:" .. lang.name .. " terms inherited from " .. origin.name .. "]]"
	end
	return make_link{
		["link_type"] = "mention",
		["code"] = origin.code,
		["word"] = args[3],
		["display"] = args[4] or args["d"] or args["display"],
		["text"] = args[5] or args["t"] or args["text"],
		["pos"] = args["pos"]
	} .. category
end

return export