Module:Protocol version

local p = {}

-- function p.protocol_version( f ) local args = f   if f == mw.getCurrentFrame then args = require( 'Module:ProcessArgs' ).merge( true ) end local version = mw.text.trim( args[1] or '' ) local type = args.type -- load the values from the submodule local version_data = mw.loadData( 'Module:Pokechu22/Sandbox/Versions' ).versions[version] local category = '' local value if version_data then value = version_data.protocol else value = '—' local title = mw.title.getCurrentTitle if not args.nocat and title.namespace == 0 and not title.isSubpage then category = '' end end return value .. category end

-- function p.data_version( f ) local args = f   if f == mw.getCurrentFrame then args = require( 'Module:ProcessArgs' ).merge( true ) end local version = mw.text.trim( args[1] or '' ) local type = args.type -- load the values from the submodule local version_data = mw.loadData( 'Module:Pokechu22/Sandbox/Versions' ).versions[version] local category = '' local value if version_data then if version_data.data then value = version_data.data else value = "N/A" end else value = '—' local title = mw.title.getCurrentTitle if not args.nocat and title.namespace == 0 and not title.isSubpage then category = '' end end return value .. category end

-- Version table function p.table( f ) local args = f   if f == mw.getCurrentFrame then args = require( 'Module:ProcessArgs' ).merge( true ) end local html = {} local groups = mw.loadData( 'Module:Pokechu22/Sandbox/Versions' ).groups

for _, group in ipairs(groups) do       table.insert( html, "=== ' .. group.name .. " ===\n" ) if group.desc ~= nil then table.insert( html, group.desc .. '\n') end table.insert( html, " \n' )   end

return table.concat( html ) end

return p