Module:Arbitration case implementation notes/Proposal/Automatic and Module:Arbitration case implementation notes/Proposal/Automatic/sandbox: Difference between pages

(Difference between pages)
Jump to navigation Jump to search
Page 1
Page 2
imported>HouseBlaster
Undid revision 1318114323 by HouseBlaster (talk) it does!!
 
imported>Aaron Liu
testing foreground text color fix in dark mode
 
Line 8: Line 8:
local pattern = args["pattern"] or "%c:?#[^:#%*].-UTC"
local pattern = args["pattern"] or "%c:?#[^:#%*].-UTC"
local ret = args["ret"] or ""
local ret = args["ret"] or ""
local title
local text = mw.title.getCurrentTitle():getContent()
local case = args["case"]
if case then
title = mw.title.new("Wikipedia:Arbitration/Requests/Case/"..case.."/Proposed decision")
else
title = mw.title.getCurrentTitle()
case = tostring(mw.title.getCurrentTitle())
case = mw.ustring.gsub(case, "%/Proposed decision", "")
case = mw.ustring.gsub(case, ".*%/", "")
end
local text = title:getContent()
local escape = mw.ustring.gsub( section, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" )
local escape = mw.ustring.gsub( section, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" )
local sectionText, matches = mw.ustring.gsub(text, ".-%=%=%= *"..escape.." *%=%=%=", "")
local sectionText, matches = mw.ustring.gsub(text, ".-%=%=%= *"..escape.." *%=%=%=", "")
sectionText = mw.ustring.gsub(sectionText, ":Comments.*", "")
sectionText = mw.ustring.gsub(sectionText, ":Comments.*", "")
local caseTitle = tostring(mw.title.getCurrentTitle())
caseTitle = mw.ustring.gsub(caseTitle, "%/Proposed decision", "")
caseTitle = mw.ustring.gsub(caseTitle, ".*%/", "")
local supportText = mw.ustring.gsub(sectionText, ".*:Support", "Support")
local supportText = mw.ustring.gsub(sectionText, ".*:Support", "Support")
Line 33: Line 27:
local abstainText = mw.ustring.gsub(sectionText, ".*:Abstain", "Abstain")
local abstainText = mw.ustring.gsub(sectionText, ".*:Abstain", "Abstain")
local _, abstain = mw.ustring.gsub(abstainText, pattern, "")
local _, abstain = mw.ustring.gsub(abstainText, pattern, "")
local supportToOppose = tonumber(args["support-to-oppose"] or 0)
support = support - supportToOppose
oppose = oppose + supportToOppose
----------------------------------------------------------------------------
----------------------------------------------------------------------------
Line 45: Line 35:
local casenavData = mw.title.new("Template:Arbitration case navigation/data"):getContent()
local casenavData = mw.title.new("Template:Arbitration case navigation/data"):getContent()
local listed -- check if at Template:casenav/data
local listed -- check if at Template:casenav/data
casenavData, listed = mw.ustring.gsub(casenavData, ".*" .. case .. "%-list", "")
casenavData, listed = mw.ustring.gsub(casenavData, ".*" .. caseTitle .. "%-list", "")
if listed == 0 or not args["autonotes"] then  
if listed == 0 or args["skipautonotes"] then  
casenavData = ""  
casenavData = ""  
else
else
Line 82: Line 72:
capt = mw.ustring.gsub(capt, "%|.*", "")
capt = mw.ustring.gsub(capt, "%|.*", "")
if string.lower(activeArbs[arb]) == string.lower(capt) then
if string.lower(activeArbs[arb]) == string.lower(capt) then
autoNotes = autoNotes .. "<td style='width: fit-content; min-width: 35px; color:var(--color-base, #202122); background:var(--background-color-success-subtle, #dff2eb)' title='"..activeArbs[arb].." supported'>S<sup>"..abbr.."</sup></td>"
autoNotes = autoNotes .. "<td style='width: fit-content; min-width: 30px; color:var(--color-base, #202122); background:var(--background-color-success-subtle, #dff2eb)' title='"..activeArbs[arb].." supported'>S<sup>"..abbr.."</sup></td>"
found = true
found = true
end
end
Line 90: Line 80:
capt = mw.ustring.gsub(capt, "%|.*", "")
capt = mw.ustring.gsub(capt, "%|.*", "")
if string.lower(activeArbs[arb]) == string.lower(capt) then
if string.lower(activeArbs[arb]) == string.lower(capt) then
autoNotes = autoNotes .. "<td style='width: fit-content; min-width: 35px; color:var(--color-base, #202122); background:var(--background-color-error-subtle, #ffe9e5)' title='"..activeArbs[arb].." opposed'>O<sup>"..abbr.."</sup></td>"
autoNotes = autoNotes .. "<td style='width: fit-content; min-width: 30px; color:var(--color-base, #202122); background:var(--background-color-error-subtle, #ffe9e5)' title='"..activeArbs[arb].." opposed'>O<sup>"..abbr.."</sup></td>"
found = true
found = true
end
end
Line 98: Line 88:
capt = mw.ustring.gsub(capt, "%|.*", "")
capt = mw.ustring.gsub(capt, "%|.*", "")
if string.lower(activeArbs[arb]) == string.lower(capt) then
if string.lower(activeArbs[arb]) == string.lower(capt) then
autoNotes = autoNotes .. "<td style='width: fit-content; min-width: 35px; color:var(--color-base, #202122); background:var(--background-color-neutral, #eaecf0)' title='"..activeArbs[arb].." abstained'>A<sup>"..abbr.."</sup></td>"
autoNotes = autoNotes .. "<td style='width: fit-content; min-width: 30px; color:var(--color-base, #202122); background:var(--background-color-neutral, #eaecf0)' title='"..activeArbs[arb].." abstained'>A<sup>"..abbr.."</sup></td>"
found = true
found = true
end
end
end
end
if not found then
if not found then
autoNotes = autoNotes .. "<td style='width: fit-content; min-width: 35px; color:var(--color-base, #202122); background:var(--background-color-neutral-subtle, #f8f9fa)' title='"..activeArbs[arb].." has not voted'>_<sup>"..abbr.."</sup></td>"
autoNotes = autoNotes .. "<td style='width: fit-content; min-width: 30px; color:var(--color-base, #202122); background:var(--background-color-neutral-subtle, #f8f9fa)' title='"..activeArbs[arb].." has not voted'>_<sup>"..abbr.."</sup></td>"
end
end
end
end
Line 123: Line 113:
..' sections with heading<br><code>==='
..' sections with heading<br><code>==='
..tostring(section)
..tostring(section)
..'===</code>'
..'===</code></span></td></tr><tr style="display:none">'
..frame:expandTemplate{title="If preview", args={"<br>If previewing a section edit, outside sections are not detected."}}
..'</span></td></tr><tr style="display:none">'
end
end