Module:Guidance: Difference between revisions
From the Audiovisual Identity Database, the motion graphics museum
Content deleted Content added
No edit summary |
Work in progress checkpoint. |
||
Line 13: | Line 13: | ||
}, |
}, |
||
{ "jumpscare", |
{ "jumpscare", |
||
"jump |
"a jump scare", |
||
"[[:wikipedia:jump scare|jump |
"a [[:wikipedia:jump scare|jump scare]]", |
||
1, |
1, |
||
}, |
}, |
||
Line 104: | Line 104: | ||
do |
do |
||
-- Timestamp parsing |
-- 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 |
||
local ri = 1 |
|||
⚫ | |||
local rt = {} |
|||
rt = string.match(rs,'%([%d,:-]*%)') |
|||
⚫ | |||
mw.log(rt) |
|||
⚫ | |||
if string.match(rt,"-") then |
|||
mw.log(rt.ri) |
|||
ri = ri + 1 |
|||
end |
|||
elseif string.match(frame.args[1],r[i][1]) and r[i][4] == 1 then |
|||
⚫ | |||
end |
|||
mw.log(rt) |
|||
rs = r[i][2]..rt |
|||
elseif string.find(frame.args[1],r[i][1]) then |
|||
⚫ | |||
end |
|||
if rd == nil then |
|||
⚫ | |||
else |
|||
rd = rs.." and "..rd |
|||
end |
end |
||
end |
end |
||
return rd |
|||
end |
end |
||
Revision as of 23:14, 21 November 2022
Documentation for this module may be created at Module:Guidance/doc
local p = {} --p stands for package
r = { --keyword, short name, formatted name, severity
{ "flashing",
"flashing images",
"[[:wikipedia:photosensitive epilepsy|flashing images]]",
1,
},
{ "graphic",
"graphic violence",
"graphic violence or gore",
2,
},
{ "jumpscare",
"a jump scare",
"a [[:wikipedia:jump scare|jump scare]]",
1,
},
{ "nudity",
"nudity",
"nudity",
2,
},
{ "sex",
"sexual activity",
"sexual activity",
2,
}
}
ri = 5
function p.reasons(frame)
for i = ri,1,-1
do
if string.find(frame.args[1],r[i][1]) then
if ro == nil then
ro = r[i][3]
elseif string.find(ro,", and ") then
ro = r[i][3]..", "..ro
else
ro = r[i][3]..", and "..ro
end
end
end
return ro;
end
function p.warn_1(frame)
for i = ri,1,-1
do
if string.find(frame.args[1],r[i][1]) and (r[i][4] == 1) then
if w1 == nil then
w1 = r[i][2].." occur."
elseif string.find(w1," and ") then
w1 = r[i][2]..", "..w1
else
w1 = r[i][2].." and "..w1
end
end
end
return w1;
end
function p.warn_2(frame)
for i = ri,1,-1
do
if string.find(frame.args[1],r[i][1]) and (r[i][4] == 2) then
if (w2 == nil) then
w2 = r[i][2]
elseif string.find(w2," and ") then
w2 = r[i][2]..", "..w2
else
w2 = r[i][2].." and "..w2
end
end
end
if w2 ~= nil then
if string.find(w2," and ") then
w2 = w2.." are"
else
w2 = w2.." is"
end
end
return w2;
end
function p.category(frame)
for i = 1,ri,1
do
if string.find(frame.args[1],r[i][1]) then
if rc == nil then
rc = "[[Category:Logos with content warnings for "..r[i][2].."]]"
else
rc = rc.."[[Category:Logos with content warnings for "..r[i][2].."]]"
end
end
end
return rc
end
-- Function for the smaller "guidance detail" notices (under testing)
function p.details(frame)
for i = ri,1,-1
do
-- Timestamp parsing
if string.match(frame.args[1],r[i][1]..'%([%d,:-]*%)') and r[i][4] == 1 then
local ri = 1
local rt = {}
for p in string.gmatch(string.match(frame.args[1],r[i][1].."%([%d,:-]*%)"), "[%d:-]+") do
rt.ri = p
mw.log(rt.ri)
ri = ri + 1
end
elseif string.match(frame.args[1],r[i][1]) and r[i][4] == 1 then
rd = r[i][2].." for the whole duration"
end
end
end
return p