Մոդուլ:Ոչ ազատ պատկերի հոդված

Վիքիպեդիայից՝ ազատ հանրագիտարանից

Documentation for this module may be created at Մոդուլ:Ոչ ազատ պատկերի հոդված/doc

local p = {}

function p.main(frame)
    local args = require('Module:Arguments').getArgs(frame)
    local isFile = mw.title.getCurrentTitle().namespace == 6
    local text = ''

    if args[1] then
        local article = mw.title.new(args[1])

        if article and article.exists then
            text = string.format("[[%s]] հոդվածի համար", args[1])
        else
            text = string.format("– Ուշադրություն: <code>%s</code> անունով հոդված գոյություն չունի<div style=\"font-size:smaller\">Ստուգեք նրա առկայությունը։</div>", args[1])

            if isFile then
                text = text .. '[[Կատեգորիա:Կարմիր հետհղումով ոչ ազատ նիշքեր]]'
            end
        end
    else
        text = "– Հոդվածի անունը չի նշված"

        if isFile then
            text = text .. '[[Կատեգորիա:Առանց հետհղումի ոչ ազատ նիշքեր]]'
        end
    end

    return text
end

return p