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 versions = {} if result and #result then for _, data in pairs( result ) do			versions[data.version] = true end end local output = '' for version, _ in pairs( versions ) do output = output .. version .. '\n' end

return output end

return p