Content deleted Content added
trained typo master |
temporary user stuff (from mw:Trust and Safety Product/Temporary Accounts#Updates) |
||
(12 intermediate revisions by the same user not shown) | |||
Line 23:
local final = ""
for _,user in next,users do
if string.match(user,"^%d+%.%d+%.%d+%.%d+$") or string.match(user,"^%x+:[%x:]+$") or string.match(user, "^~%d%d%d%d%-%d%d%d%d%d%-%d%d%d$") then --Lazy but mostly working basic IPv6 regex
final = final .. "[[Special:Contributions/"..user.."|"..user.."]], "
else
Line 52:
end
--This is a bloody mess of a mix of ideas, but it mostly works, so
local function getUserMentions(text)
--Returns a list of users, and if they were considered a "participant" or someone who was just mentioned
local mentions = {}
text = mw.text.decode(text,true)
--Timestamp is %d%d:%d%d, %d%d? %w+ %d%d%d%d %(UTC%)) but we allow some (minor) leniancy for those who just slightly edit their dates (why?) so that it still picks up
local timestampRegex = "((%d%d:%d%d, %d%d? %w+,? %d%d%d%d) %(UTC%))"
local userRegex = "(%[%[:?
local userTalkRegex = "(%[%[:?
local userContribRegex = "(%[%[:?
for line in string.gmatch(text,"[^\n]+") do
--Split by line and check all content on said line. This assumes all signatures never use newlines, which they should not be doing anyways.
Line 74 ⟶ 75:
break
end
identifier = string.gsub(identifier,"_"," ")
if not string.find(identifier,"/") then --Avoid subpage nonsense
usersOnThisLine[string.find(targetText,reg)] = identifier
end
Line 129 ⟶ 130:
assert(type(page)=="string","Invalid or no page provided")
local
return Transcluder.get(page)
end, function(err)
error(debug.traceback())
end)
local sections = getSectionData(text)
local tableContent = '{| class="wikitable sortable"\n! style="text-align:center" colspan=6 | Conversation summary for [[' .. page .. ']]' ..
'<span style="position:absolute;right:2em;font-size:90%">[[Module:Sandbox/Aidan9382/DiscussionOverview|v]]</span>' ..
for _,section in next,sections do
local sanitisedName = string.gsub(string.gsub(mw.uri.anchorEncode(frame:preprocess(section.name)),"%[%[:?[^|]-|([^%]]-)]]","%1"),"%[%[:?([^%]]-)]]","%1")
local displayName = string.gsub(string.gsub(frame:preprocess(section.name),"%[%[:?[^|]-|([^%]]-)]]","%1"),"%[%[:?([^%]]-)]]","%1")
local wikilinkAnchor = "[[:"..page.."#"..sanitisedName.."|"..
local membersInText = getUserMentions(section.content)
local uniqueParticipants = {}
Line 178 ⟶ 184:
end
end
local firstComment,lastComment
|