ሞድዩል:Wikibase

ካብ ዊኪፐድያ፣ ናጻ ኢንሳይክሎፐድያ
ናብ መዳህሰሲ ኪድ ናብ ምድላይ ኪድ

Documentation for this module may be created at ሞድዩል:Wikibase/doc

-- Module:Wikibase
local p = {}
 
-- Returns the item ID, name or link of the page in the local wiki.
function p.id(frame)
        if not mw.wikibase then
           return "wikibase module not found"
        end
 
        entity = mw.wikibase.getEntityObject()
 
        if entity == nil then
           return ""
        end
 
        return entity.id
end
 
-- Returns the label of a given item.
function p.label(frame)
        if frame.args[1] == nil then
            entity = mw.wikibase.getEntityObject()
            if not entity then return nil end
 
            id = entity.id
        else
            id = frame.args[1]
        end
 
        return mw.wikibase.label( id )
end
 
-- Returns the local page of a given item.
function p.link(frame)
        if frame.args[1] == nil then
            entity = mw.wikibase.getEntityObject()
            if not entity then return nil end
 
            id = entity.id
        else
            id = frame.args[1]
        end
 
        return mw.wikibase.sitelink( id )
end

-- Returns the description of a given item.
function p.description(frame)
        if frame.args[1] == nil then
            entity = mw.wikibase.getEntityObject()
            if not entity then return nil end
 
            id = entity.id
        else
            id = frame.args[1]
        end
 
        return mw.wikibase.description( id )
end
 
return p