Jump to content

Module:Sandbox/Perryprog/xlink

From Wikipedia, the free encyclopedia

local p = {}
local prevDiffStart = "https://en%.wikipedia%.org/w/index%.php%?title=.-&diff=prev&"

function p.xlink(frame)
	-- https://en.wikipedia.org/w/index.php?title=User_talk:Perryprog&diff=prev&oldid=999347924&diffmode=source
	-- Should become {{diff2|999347924}}
	local match = string.match(frame.args[1], prevDiffStart .. "oldid=(%d+)")
	return frame:expandTemplate({title = "Diff2", args = {match}})
end

return p