Module:InterPro content

local getArgs = require('Module:Arguments').getArgs

local beginText = 'This article incorporates text from the public domain Pfam and InterPro: ' local baseUrl = 'https://www.ebi.ac.uk/interpro/entry/'

local p = {}

local function interproLink(arg) -- text before first space, if any; otherwise, whole arg local accessionNumber = arg:match('^([^ ]*) ') or arg

-- text after first space, if any; otherwise, accessionNumber local linkText = arg:match(' (.*)') or accessionNumber return '[' .. baseUrl .. accessionNumber .. ' ' .. linkText .. ']' end

local function renderList(args) local list_args = { class = 'inline' }   for _, a in ipairs(args) do    	table.insert(list_args, interproLink(a)) end

return require('Module:List').horizontal(list_args) end

function p.main(frame) local args = getArgs(frame)

if not args[1] then return ' Module:InterPro content: required argument 1 is missing ' elseif not args[2] then return ' ' .. beginText .. interproLink(args[1]) .. ' '	else return ' ' .. beginText .. renderList(args) .. ' '	end end

return p