مَوادَس کُن گٔژھِو

Module:Jct

وِکیٖپیٖڈیا پؠٹھٕ، اَکھ آزاد اِنسایکلوپیٖڈیا

"یَمہٕ ماڈیوٗلُک دَستاویز ییٚہِ Module:Jct/دَستاویز جاے بَناونہٕ"

-- ====================================================================
-- Module:Jct
-- Custom junction links
-- ====================================================================

local p = {}

function p.jct(frame)
	local args = frame:getParent().args
	local type = args[1] or ""       -- e.g. NH, AH
	local num  = args[2] or ""       -- e.g. 44
	local file = args.file or ""     -- manual override

	local shield = ""
	local link   = ""

	-- 🔹 Manual file override
	if file ~= "" then
		shield = string.format("[[File:%s|20px]] ", file)
		link   = string.format("[[%s%s|%s %s]]", type, num, type, num)

	-- 🔹 Default for NH
	elseif type == "NH" then
		shield = string.format("[[Image:NH%s-IN.svg|20px]] ", num)
		link   = string.format("[[قومی مَہوَتھ %s (ہِندوستان)|NH %s]]", num, num)

	-- 🔹 Default for AH (still pattern based)
	elseif type == "AH" then
		shield = string.format("[[File:Asian Highway %s.svg|20px]] ", num)
		link   = string.format("[[%s%s|%s%s]]", type, num, type, num)

	-- 🔹 Fallback (just link)
	else
		link = string.format("[[%s%s|%s%s]]", type, num, type, num)
	end

	return shield .. link
end

return p