Weekly featured soldier rotation module
 
Only parse bullets under == Pool ==
Line 92: Line 92:
local content = titleObj:getContent()
local content = titleObj:getContent()
if not content or content == '' then
if not content or content == '' then
return {}
end
-- Only read bullets under == Pool == (ignore examples elsewhere on the page)
local section = mw.ustring.match(content, '\n==%s*Pool%s*==\n(.-)\n==%s*')
if not section then
section = mw.ustring.match(content, '^==%s*Pool%s*==\n(.-)\n==%s*')
end
if not section then
section = mw.ustring.match(content, '\n==%s*Pool%s*==\n(.*)$')
or mw.ustring.match(content, '^==%s*Pool%s*==\n(.*)$')
end
if not section then
return {}
return {}
end
end


local entries = {}
local entries = {}
for line in mw.text.gsplit(content, '\n', true) do
for line in mw.text.gsplit(section, '\n', true) do
local entry = parseLine(line)
local entry = parseLine(line)
if entry then
if entry then