Module:Utils

local p = {}

function p.getHostFromURL( frame ) s = frame.args[1] return (s.."/"):match("://(.-)[:/]") end

function p.stripAPIURL( frame ) s = frame.args[1] return s:match("https?://(.+)") end

function p.getBranchNumber( frame ) s = frame.args[1] return s:match("%.(%d+)") end

function p.getExtensionVersions( frame ) extensionName = frame.args[1] local query = { 'Has extension::Extension:'..extensionName..'', 'Has extension version::!~*MLEB*', '?Has extension version=version' }	query.mainlabel = '-' query.limit = 5000 query.sort = 'Has extension version' query.order = 'descending'

local result = mw.smw.ask( query ) local output = '' if result and #result then for num, entityData in pairs( result ) do output = output .. entityData.version .. '\n' end end

return output end

return p