local p = {}
local sub = mw.ustring.sub
local find = mw.ustring.find
local gmatch = mw.ustring.gmatch
local trim = mw.text.trim
function p.decision( frame )
local case = frame.args[1] or frame.args.case
return p._decision( case )
end
function p._decision( case )
local page = 'Wikipedia:Arbitration/Requests/Case/' .. case
local pagecontent = mw.title.new(page):getContent()
local fdstart = find(pagecontent, '\n=Final decision')
local fd = sub(pagecontent, fdstart)
local result = {}
local re = '\n==(.-)=='
for str in gmatch(fd, re) do
if find(str, '^Enforcement') then
break
end
if find(str, '^=') then
s = trim(sub(str, 2))
table.insert(result, ':[[' .. page .. '#' .. s .. '|' .. s .. ']]')
else
table.insert(result, "'''" .. str .. "'''")
end
end
local output = table.concat(result, '\n')
mw.log(output)
return output
end
return p