Modul:Gotara bingehîn

Belgekirina modulê[biafirîne]
local p = {}

local function expandIcon(ikon)
    if not ikon then return "" end
    return mw.getCurrentFrame():expandTemplate{
        title = "class/icon",
        args = {ikon}
    }
end

local function linkCeke(ku_page, cuda, en_page, ikon, ikon2, level, stur, italik)

    local link = ""
	if ikon then
	    local show_ikon = expandIcon(ikon)
		link = link.. show_ikon .. " "
	end
	if ikon2 then
	    local show_ikon2 = expandIcon(ikon2)
		link = link.. show_ikon2 .. " "
	end
    if ku_page then
    	link = link
    	.. (stur and "<b>" or "") .. (italik and "<i>" or "")
    	.. "[[" .. ku_page .. (cuda and "|" .. cuda or "") .. "]]"
    	..(italik and "</i>" or "").. (stur and "</b>" or "") 
    	.. " "
    end
	if en_page then
	    if ku_page then
	        link = link .. " ([[:en:" .. en_page .. "|en]])" .. " "
		else
        	link = link 
        	.. (stur and "<b>" or "") .. (italik and "<i>" or "") 
        	.. "[[" .. en_page .. "]]" 
        	.. (italik and "</i>" or "").. (stur and "</b>" or "") 
        	.. " ([[:en:" .. en_page .. "|en]])" .. " "
	    end
	end
	if level then 
	    -- Convert level to a number
	    level = tonumber(level)
	    if level == 3 then
	        link = link .. "([[Wîkîpediya:Gotarên bingehîn|Level ".. level .."]])"
	    else
	        link = link .. "([[Wîkîpediya:Gotarên bingehîn/Level/".. level .."|Level ".. level .."]])"
	    end
	end

    return link
end

function p.biwesine(frame)
    local args = frame:getParent().args
    local ku_page = args[1]  
    local cuda = args[2]
    local en_page = args["en"]
    local ikon = args["îkon"]
    local ikon2 = args["îkon2"]
    local level = args["level"]
    local stur = args["stûr"]
    local italik = args["îtalîk"]
    local link = linkCeke(ku_page, cuda, en_page, ikon, ikon2, level, stur, italik)

    return link
end

return p