İçeriğe atla

Modül:Kanun: Revizyonlar arasındaki fark

Hukukipedia sitesinden
k Kanun maddelerini Popups uyumlu iç wiki bağlantıları yap
k Madde bağlantılarını Popups uyumlu HTML iç bağlantıya çevir
4. satır: 4. satır:
     local sayi = tonumber(frame.args["sayı"] or frame.args["madde_sayısı"] or "0") or 0
     local sayi = tonumber(frame.args["sayı"] or frame.args["madde_sayısı"] or "0") or 0
     sayi = math.floor(sayi)
     sayi = math.floor(sayi)
 
     if sayi < 1 then return '<div class="hk-law-empty">Madde sayısı belirtilmemiş.</div>' end
     if sayi < 1 then
     if sayi > 2000 then sayi = 2000 end
        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"]
     local kok = frame.args["kök"]
     if not kok or kok == "" then
     if not kok or kok == "" then kok = mw.title.getCurrentTitle().prefixedText end
        kok = mw.title.getCurrentTitle().prefixedText
    end
 
     local safeKok = mw.text.encode(kok)
     local safeKok = mw.text.encode(kok)
     local cikti = {
     local cikti = {
27. satır: 18. satır:
     for i = 1, sayi do
     for i = 1, sayi do
         local madde = "Madde " .. i
         local madde = "Madde " .. i
         -- Tüm maddeler gerçek wiki içi bağlantıdır. MediaWiki mevcut
         local hedef = mw.title.new(kok .. "/" .. madde)
        -- sayfaları normal, eksik sayfaları .new olarak işaretler.
         local link = mw.html.create('a')
         -- Common.js eksik .new bağlantılarını PageForms'a yönlendirir;
            :attr('href', hedef:getLocalUrl())
         -- Popups ise mevcut sayfaların içeriğini önizleyebilir.
            :wikitext(madde)
         cikti[#cikti + 1] = "[[" .. kok .. "/" .. madde .. "|" .. madde .. "]]"
         if not hedef.exists then link:addClass('new') end
         cikti[#cikti + 1] = tostring(link)
     end
     end



18.23, 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 safeKok = mw.text.encode(kok)
    local cikti = {
        '<div class="hk-law-articles" aria-label="Kanun maddeleri" data-law-title="' .. safeKok .. '">',
        '<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 link = mw.html.create('a')
            :attr('href', hedef:getLocalUrl())
            :wikitext(madde)
        if not hedef.exists then link:addClass('new') end
        cikti[#cikti + 1] = tostring(link)
    end

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

return p