Module:Guidance: Difference between revisions

Jump to navigation Jump to search
no edit summary
imported>Pingu
(Work in progress checkpoint.)
imported>Pingu
No edit summary
Line 31: Line 31:


function p.reasons(frame)
function p.reasons(frame)
for i = ri,1,-1
for i = ri,1,-1 do
do
if string.find(frame.args[1],r[i][1]) then
if string.find(frame.args[1],r[i][1]) then
if ro == nil then
if ro == nil then
Line 47: Line 46:
function p.warn_1(frame)
function p.warn_1(frame)
for i = ri,1,-1
for i = ri,1,-1 do
do
if string.find(frame.args[1],r[i][1]) and (r[i][4] == 1) then
if string.find(frame.args[1],r[i][1]) and (r[i][4] == 1) then
if w1 == nil then
if w1 == nil then
Line 63: Line 61:


function p.warn_2(frame)
function p.warn_2(frame)
for i = ri,1,-1
for i = ri,1,-1 do
do
if string.find(frame.args[1],r[i][1]) and (r[i][4] == 2) then
if string.find(frame.args[1],r[i][1]) and (r[i][4] == 2) then
if (w2 == nil) then
if (w2 == nil) then
Line 86: Line 83:


function p.category(frame)
function p.category(frame)
for i = 1,ri,1
for i = 1,ri,1 do
do
if string.find(frame.args[1],r[i][1]) then
if string.find(frame.args[1],r[i][1]) then
if rc == nil then
if rc == nil then
Line 100: Line 96:


-- Function for the smaller "guidance detail" notices (under testing)
-- Function for the smaller "guidance detail" notices (under testing)
function p.details(frame)
function p.detail(frame)
for i = ri,1,-1
for i = ri,1,-1 do
do
if string.find(frame.args[1],r[i][1]) and r[i][4] == 1 then
-- Timestamp parsing
if string.match(frame.args[1],r[i][1]..'%([%d,:-]*%)') then
if string.match(frame.args[1],r[i][1]..'%([%d,:-]*%)') and r[i][4] == 1 then
ti = 0
local ri = 1
tt = {}
local rt = {}
for j in string.gmatch(string.match(frame.args[1],r[i][1].."%([%d,:-]*%)"),"[%d:-]+") do
for p in string.gmatch(string.match(frame.args[1],r[i][1].."%([%d,:-]*%)"), "[%d:-]+") do
ti = ti + 1
rt.ri = p
tt[ti] = j
mw.log(rt.ri)
end
ri = ri + 1
for j = ti,1,-1 do
end
if ts == nil then
elseif string.match(frame.args[1],r[i][1]) and r[i][4] == 1 then
ts = tt[j]
rd = r[i][2].." for the whole duration"
elseif string.find(ts," and ") then
ts = tt[j]..", "..ts
else
ts = tt[j].." and "..ts
end
end
td = "'''"..r[i][3].."''' at "..ts
else
td = "'''"..r[i][3].."''' for the whole duration"
end
if rd == nil then
rd = td
elseif string.find(rd,", and ") then
rd = td..", "..rd
else
rd = td..", and "..rd
end
end
end
end
end
return rd
end
end


return p
return p
Anonymous user

Navigation menu