Module:Sandbox/Bradv/Case: Difference between revisions

Content deleted Content added
.
.
Line 5:
local gmatch = mw.ustring.gmatch
local trim = mw.text.trim
 
--[[function p.list()
local frame = mw.getCurrentFrame()
local s = frame:callParserFunction{
name = '#categorytree',
args = {'Wikipedia arbitration cases'}
}
mw.log(mw.text.unstrip(s))
end
--]]
 
local prefix = 'Wikipedia:Arbitration/Requests/Case/'
local talk = 'Wikipedia talk:Arbitration/Requests/Case/'
 
function p.dates( frame )
local case = frame.args[1] or frame.args.case
return p._dates( case )
end
function p._dates( case )
local page = prefix .. case
local pagecontent = mw.title.new(page):getContent()
local result = {}
local re = '\n<big>(.-)</big>'
for str in gmatch (pagecontent, re) do
table.insert(result, trim(str))
end
return table.concat(result, '\n')
end
 
function p.decision( frame )
Line 11 ⟶ 39:
end
function p._decision( case )
local page = 'Wikipedia:Arbitration/Requests/Case/'prefix .. case
local pagecontent = mw.title.new(page):getContent()
local fdstart = find(pagecontent, '\n=Final decision')
Line 31 ⟶ 59:
mw.log(output)
return output
end
 
function p.arca( frame )
local case = frame.args[1] or frame.args.case
return p._arca( case )
end
function p._arca( case )
local page = talk .. case
local pagecontent = mw.title.new(page):getContent()
local result = {}
local re = '\n==(.-)=='
for str in gmatch (pagecontent, re) do
str = trim(str)
if find(str, '^Amendment request')
or find(str, '^Clarification request') then
table.insert(result, ':[[' .. page .. '#' .. str .. '|' .. str .. ']]')
end
end
return table.concat(result, '\n')
end