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/'
Line 44 ⟶ 34:
local fd = sub(pagecontent, fdstart)
local result = {}
local count = 0
local re = '\n==(.-)=='
for str in gmatch(fd, re) do
Line 51 ⟶ 42:
if find(str, '^=') then
s = trim(sub(str, 2))
table.insert(result, '*:[[' .. page .. '#' .. s .. '|' .. s .. ']]')
else
table.insert(result, "'''" .. str .. "'''")
end
count = count + 1
end
return table.concat(result, '\n')
local output = ''
mw.log(count)
if (count > 0) then
local div = mw.html.create( 'div' )
div
:css( 'text-align', 'left')
return :wikitext( table.concat(result, '\n'))
output = tostring( div )
else
output = "''none''"
end
return output
end
 
Line 67 ⟶ 71:
local pagecontent = mw.title.new(page):getContent()
local result = {}
local count = 0
local re = '\n==(.-)=='
for str in gmatch (pagecontent, re) do
Line 73 ⟶ 78:
or find(str, '^Clarification request') then
table.insert(result, '*[[' .. page .. '#' .. str .. '|' .. str .. ']]')
count = count + 1
end
end
if (count > 0) then
return table.concat(result, '\n')
local div = mw.html.create( 'div' )
div
:css( 'text-align', 'left')
return :wikitext( table.concat(result, '\n') )
output = tostring( div )
else
output = "''none''"
end
return output
end