Module:Sandbox/Bradv/Case: Difference between revisions

Content deleted Content added
.
.
 
(8 intermediate revisions by the same user not shown)
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 ptalk = 'Wikipedia talk:Arbitration/Requests/Case/'
 
function render ( tbl, count )
local output = ''
if find(str,count '^='> 0) then
local div = mw.html.create( 'div' )
div
:css( 'text-align', 'left' )
:wikitext( '<p>\n' .. table.concat(tbl, '</p><p>\n') .. '</p>\n' )
output = tostring( div )
else
output = "''none''"
end
return output
end
 
function p.dates( frame )
Line 29 ⟶ 33:
local re = '\n<big>(.-)</big>'
for str in gmatch (pagecontent, re) do
table.insert(result, '*' .. trim(str))
end
return table.concatrender( result, '\n'1 )
end
 
Line 44 ⟶ 48:
local fd = sub(pagecontent, fdstart)
local result = {}
local count = 0
local re = '\n==(.-)=='
for str in gmatch(fd, re) do
if find(str, '^%s*Enforcement') then
break--ignore
end
if find(str, '^=') then
s = trim(sub(str, 2))
table.insert(result, '*[[' .. page .. '#' .. s .. '|' .. s .. ']]')
else
if find(str, '^=') then
table.insert(result, "'''" .. str .. "'''")
s = trim(sub(str, 2))
table.insert(result, '*:[[' .. page .. '#' .. s .. '|' .. s .. ']]')
else
table.insert(result, "'''" .. str .. "'''")
end
count = count + 1
end
end
return table.concatrender ( result, '\n'count )
end
 
Line 67 ⟶ 75:
local pagecontent = mw.title.new(page):getContent()
local result = {}
local count = 0
local re = '\n==(.-)=='
for str in gmatch (pagecontent, re) do
Line 72 ⟶ 81:
if find(str, '^Amendment request')
or find(str, '^Clarification request') then
table.insert(result, '*[[' .. page .. '#' .. str .. '|' .. str .. ']]')
count = count + 1
end
end
return table.concatrender ( result, '\n'count )
end
 
function p.sections( frame )
local case = frame.args[1] or frame.args.case
return p._sections( case, delim )
local delim = frame.args[2] or frame.args.delim or '\n'
return p._sections( case, delim )
end
function p._sections( case, delim )
local page = prefix .. case
local talkpage = ptalk .. case
Line 111 ⟶ 120:
add('Proposed decision')
 
return table.concat(result, delim' • ')
end