66 383
contributi
mNessun oggetto della modifica |
Nessun oggetto della modifica |
||
Riga 416: | Riga 416: | ||
function p.ListBackReferences(frame) | function p.ListBackReferences(frame) | ||
local AllBackReferences = {} | local AllBackReferences = {} | ||
--[=[ | |||
local QueryResult = mw.smw.ask('[[Riferimento::' .. mw.title.getCurrentTitle().text .. ']]|?DataTrek ID|format=broadtable') | local QueryResult = mw.smw.ask('[[Riferimento::' .. mw.title.getCurrentTitle().text .. ']]|?DataTrek ID|format=broadtable') | ||
if not QueryResult then | if not QueryResult then | ||
Riga 434: | Riga 434: | ||
end | end | ||
return table.concat(AllBackReferences, string.char(10)) | return table.concat(AllBackReferences, string.char(10)) | ||
end | end | ||
]=] | |||
--local QueryResult = mw.smw.getQueryResult('[[Riferimento::' .. mw.title.getCurrentTitle().text .. ']]|?DataTrek ID') | |||
--local queryResult = mw.smw.getQueryResult( frame.args ) | |||
local queryResult = mw.smw.getQueryResult('[[Riferimento::' .. mw.title.getCurrentTitle().text .. ']]|?DataTrek ID') | |||
if queryResult == nil then | |||
return "(no values)" | |||
end | |||
if type( queryResult ) == "table" then | |||
local myResult = "" | |||
for k,v in pairs( queryResult.results ) do | |||
if v.fulltext and v.fullurl then | |||
myResult = myResult .. k .. " | " .. v.fulltext .. " " .. v.fullurl .. " | " .. "<br/>" | |||
else | |||
myResult = myResult .. k .. " | no page title for result set available (you probably specified ''mainlabel=-')" | |||
end | |||
end | |||
return myResult | |||
end | |||
return queryResult | |||
end | end | ||
return p | return p |