İçeriğe atla

Modül:Kanun: Revizyonlar arasındaki fark

Hukukipedia sitesinden
Kanun madde listesinin HTML kaçışlama sorununu düzelt
Eksik maddeleri otomatik forma yönlendir
27. satır: 27. satır:
         local madde = "Madde " .. i
         local madde = "Madde " .. i
         local hedef = mw.title.new(kok .. "/" .. madde)
         local hedef = mw.title.new(kok .. "/" .. madde)
         cikti[#cikti + 1] = "[" .. hedef:fullUrl() .. " " .. madde .. "]"
        local url
 
        if hedef and hedef.exists then
            url = hedef:fullUrl()
        else
            url = mw.uri.fullUrl(
                "Special:FormEdit/Kanun Maddesi/" .. kok .. "/" .. madde,
                { kanun = kok, madde = tostring(i) }
            )
        end
 
         cikti[#cikti + 1] = "[" .. url .. " " .. madde .. "]"
     end
     end



17.48, 31 Ağustos 2026 tarihindeki hâli

Bu modül için bir Modül:Kanun/belge belgelendirmesi oluşturabilirsiniz

local p = {}

function p.maddeListesi(frame)
    local sayi = tonumber(frame.args["sayı"] or frame.args["madde_sayısı"] or "0") or 0
    sayi = math.floor(sayi)

    if sayi < 1 then
        return '<div class="hk-law-empty">Madde sayısı belirtilmemiş.</div>'
    end

    if sayi > 2000 then
        sayi = 2000
    end

    local kok = frame.args["kök"]
    if not kok or kok == "" then
        kok = mw.title.getCurrentTitle().prefixedText
    end

    local cikti = {
        '<div class="hk-law-articles" aria-label="Kanun maddeleri">',
        '<div class="hk-law-articles-title">Kanun maddeleri</div>',
        '<div class="hk-law-articles-list">'
    }

    for i = 1, sayi do
        local madde = "Madde " .. i
        local hedef = mw.title.new(kok .. "/" .. madde)
        local url

        if hedef and hedef.exists then
            url = hedef:fullUrl()
        else
            url = mw.uri.fullUrl(
                "Special:FormEdit/Kanun Maddesi/" .. kok .. "/" .. madde,
                { kanun = kok, madde = tostring(i) }
            )
        end

        cikti[#cikti + 1] = "[" .. url .. " " .. madde .. "]"
    end

    cikti[#cikti + 1] = "</div>"
    cikti[#cikti + 1] = "</div>"
    return table.concat(cikti, "\n")
end

return p