Difference between revisions of "Module:Sandbox01"

From Rhizome Artbase
Jump to navigation Jump to search
m
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
local p = {}
 
local p = {}
 
+
function p.ftn01( frame )
+
     return "this is ftn01, created April 27, 2016.\n"
+
function p.id(frame)
 +
 +
     if not mw.wikibase then
 +
        return "no mw.wikibase"
 +
    end
 +
 +
    entity = mw.wikibase.getEntityObject()
 +
 +
    if entity == nil then
 +
        return "no entity"
 +
    end
 +
 +
    return entity.id
 
end
 
end
 
+
 
+
function p.ftn02( frame )
+
function p.label(frame)
     return "this is ftn02, created April 27, 2016.\n"
+
     return mw.wikibase.label( frame.args[1] )
 
end
 
end
 
+
function p.ftn03( frame )
+
function p.list(frame)
    local ftnname = frame.args[1]
+
        rows = ""
    local ftnname02 = frame.args[2]
+
        for item_number=1000,2000 do
    return 'this is '.. ftnname ..' ,created April 27, 2016.\n'..'and '..ftnname02..'  also.'
+
            local item_id = "Q" .. item_number           
 +
            local label = mw.wikibase.label( item_id )
 +
            if label == nil then
 +
              label = ""
 +
              end
 +
          --local plug_ins = mw.wikibase.label (P86) 
 +
          local bp = mw.wikibase.resolvePropertyId('P86')         
 +
            row = "<tr><td>" .. item_id .. "</td><td>" .. label .. "</td><td>" .. bp .. "</td></tr>\n"
 +
            rows = rows .. row
 +
        end
 +
    return "<table class=\"wikitable sortable\">\n<tr><th>id</th><th>label</th><th>bp</th></tr>\n" .. rows .. "</table>"
 
end
 
end
 
+
 +
function p.getItem(frame)
 +
 +
    local item = mw.wikibase.getEntity( "Q1996" )
 +
    local instance_of = item.formatPropertyValues( "P3" )
 +
    return instance_of.value
 +
end
 +
 +
 +
function p.page(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
 +
 
return p
 
return p

Latest revision as of 23:40, 8 May 2016


local p = {}
 
 
function p.id(frame)
 
    if not mw.wikibase then
        return "no mw.wikibase"
    end
 
    entity = mw.wikibase.getEntityObject()
 
    if entity == nil then
        return "no entity"
    end
 
    return entity.id
end
 
 
function p.label(frame)
    return mw.wikibase.label( frame.args[1] )
end
 
function p.list(frame)
        rows = ""
        for item_number=1000,2000 do
            local item_id = "Q" .. item_number            
            local label = mw.wikibase.label( item_id )
            if label == nil then
               label = ""
               end
           --local plug_ins = mw.wikibase.label (P86)   
           local bp = mw.wikibase.resolvePropertyId('P86')          
            row = "<tr><td>" .. item_id .. "</td><td>" .. label .. "</td><td>" .. bp .. "</td></tr>\n"
            rows = rows .. row
        end
    return "<table class=\"wikitable sortable\">\n<tr><th>id</th><th>label</th><th>bp</th></tr>\n" .. rows .. "</table>"
end
 
function p.getItem(frame)
 
    local item = mw.wikibase.getEntity( "Q1996" )
    local instance_of = item.formatPropertyValues( "P3" )
    return instance_of.value
end
 
 
function p.page(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
 
return p