local p =
p.test = function(frame) local mytable = for i=1,5 do mytable[i] = i*10 end return table.concat(mytable, ", ")end
-- looking at Richard Burton Q151973 and his spouses P26-- using -- try - which fails-- see https://www.mediawiki.org/wiki/Wikibase/Notes/JSON-- see https://www.mediawiki.org/wiki/Extension:Wikibase_Client/Lua-- see https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual-- see https://en.wikipedia.org/wiki/Richard_Burton-- see https://www.wikidata.org/wiki/Q151973-- Also see for https://en.wikipedia.org/wiki/New_York_Cityp.getPropertyAndQualifier = function(frame) local propertyID = mw.text.trim(frame.args[1] or "") local qualifierID = mw.text.trim(frame.args[2] or "") local input_parm = mw.text.trim(frame.args[3] or "") if input_parm
'value' then if v.mainsnak.datavalue.type
'time' then -- return the year local dt = vq.datavalue.value.time -- local dt = v.qualifiers[qualifierID][1].datavalue.value.time if #dt > 26 then --date later than 99 CE val = val .. ' (' .. string.sub(dt, 9, 12) .. ')' else -- date earlier than 100 CE val = val .. ' (' .. string.sub(dt, 9, 10) .. ')' end end end -- next kq, vq end elseif v.mainsnak.datavalue.type
'globecoordinate' then -- type is globecoordinate - do this later if val then val = val .. ', ' .. 'globecoordinate' else val = 'globecoordinate' end elseif v.mainsnak.datavalue.type
'quantity' then -- type is quantity local quant = entity:formatPropertyValues(propertyID, mw.wikibase.entity.claimRanks).value quant = mw.ustring.gsub(quant, "(%d),(%d)", "%1%2") -- remove thousands separators if val then val = val .. ', ' .. quant else val = quant end else -- type is not known (to be dealt with later) if val then val = val .. ', ' .. 'unknown' else val = 'unknown' end end else -- mainsnaktype is unknown value or novalue if val then val = val .. ', noval' else val= 'noval' end end end -- next k,v if ret then return ret else return val end else -- no props return "" end else -- wikidata value not required so return local value return input_parm endend
p.getRawPropertyValue = function(frame) local propertyID = mw.text.trim(frame.args[1] or "") local input_parm = mw.text.trim(frame.args[2] or "") if input_parm
'value' then if v.mainsnak.datavalue.type
'string' then -- type is string if val then val = val .. ', ' .. v.mainsnak.datavalue.value else val = v.mainsnak.datavalue.value end elseif v.mainsnak.datavalue.type
'time' then -- type is time - do this later if val then val = val .. ', ' .. 'time' else val = 'time' end elseif v.mainsnak.datavalue.type
-- -- p.getDescription = function(frame) local input_parm = mw.text.trim(frame.args[1] or "") local lang = mw.text.trim(frame.args[2] or mw.language.getContentLanguage.code) -- if language code not supplied, use lang code local to this wiki if input_parm
return p