Modül:Kanun
Görünüm
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] = link:done()
end
cikti[#cikti + 1] = "</div>"
cikti[#cikti + 1] = "</div>"
return table.concat(cikti, "\n")
end
return p