İçeriğe atla

Modül:Kanun: Revizyonlar arasındaki fark

Hukukipedia sitesinden
k Madde bağlantılarını Popups uyumlu HTML iç bağlantıya çevir
k Madde bağlantılarını Popups uyumlu iç HTML bağlantıya çevir
6. satır: 6. satır:
     if sayi < 1 then return '<div class="hk-law-empty">Madde sayısı belirtilmemiş.</div>' end
     if sayi < 1 then return '<div class="hk-law-empty">Madde sayısı belirtilmemiş.</div>' end
     if sayi > 2000 then sayi = 2000 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 kok = mw.title.getCurrentTitle().prefixedText end
     if not kok or kok == "" then kok = mw.title.getCurrentTitle().prefixedText end
15. satır: 14. satır:
         '<div class="hk-law-articles-list">'
         '<div class="hk-law-articles-list">'
     }
     }
     for i = 1, sayi do
     for i = 1, sayi do
         local madde = "Madde " .. i
         local madde = "Madde " .. i
         local hedef = mw.title.new(kok .. "/" .. madde)
         local hedef = mw.title.new(kok .. "/" .. madde)
         local link = mw.html.create('a')
        local url = tostring(hedef:fullUrl()):gsub("^https?://[^/]+", "")
            :attr('href', hedef:getLocalUrl())
         local link = mw.html.create('a'):attr('href', url):wikitext(madde)
            :wikitext(madde)
         if not hedef.exists then link:addClass('new') end
         if not hedef.exists then link:addClass('new') end
         cikti[#cikti + 1] = tostring(link)
         cikti[#cikti + 1] = tostring(link)
     end
     end
     cikti[#cikti + 1] = "</div>"
     cikti[#cikti + 1] = "</div>"
     cikti[#cikti + 1] = "</div>"
     cikti[#cikti + 1] = "</div>"

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 url = tostring(hedef:fullUrl()):gsub("^https?://[^/]+", "")
        local link = mw.html.create('a'):attr('href', url):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