Module:SMW: Difference between revisions
From devsummit
(=p.sessionTable()) |
No edit summary |
||
Line 20: | Line 20: | ||
end | end | ||
local | local result = "\n{| class='wikitable\n" | ||
for | for k1,v1 in pairs( sessions.results ) do | ||
result = result .. "![[" .. v1.fulltext .. "]]\n" | |||
end | end | ||
for k1,v1 in pairs( sessions.results ) do | |||
result = result .. "|-\n![[" .. v1.fulltext .. "]]\n" | |||
end | |||
result = result .. "|}" | |||
return | return result | ||
end | end | ||
return p | return p |
Revision as of 08:53, 27 November 2017
Documentation for this module may be created at Module:SMW/doc
-- Module:SMW
local p = {}
-- Return results
function p.sessionTable(frame)
local sessions = mw.smw.getQueryResult( "[[Category:Sessions]]" )
if sessions == nil then
return "(no values)"
end
if type( sessions ) ~= "table" then
return "(invalid query result)"
end
local statements = {};
for k,v in pairs( sessions.results ) do
statements[v.fulltext] = mw.smw.getQueryResult( "[[Category:Statements]][[Session::" .. v.fulltext .. "]]" )
end
local result = "\n{| class='wikitable\n"
for k1,v1 in pairs( sessions.results ) do
result = result .. "![[" .. v1.fulltext .. "]]\n"
end
for k1,v1 in pairs( sessions.results ) do
result = result .. "|-\n![[" .. v1.fulltext .. "]]\n"
end
result = result .. "|}"
return result
end
return p