Jump to content

Module:InterPro content

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Matt Fitzpatrick (talk | contribs) at 21:59, 30 August 2018 (args). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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

local p = {}

local function interproLink(entry)
	return '[https://www.ebi.ac.uk/interpro/entry/' .. entry .. ' ' .. entry .. ']'
end

local function renderList(args)
	local listRoot = mw.html.create('ul')
		:addClass('hlist')

    for _, e in ipairs(args) do
		listRoot
			:tag('li')
				:wikitext(interproLink(e))
    end

	return listRoot
end

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

	if not args[1] then
		return '<div class="error">[[Module:InterPro content]]: required argument 1 is missing</div>'
    elseif not args[2] then
		return '<div role="note" style="font-style: italic;">This article incorporates text from the public domain [[Pfam]] and [[InterPro]] ' .. interproLink(args[1]) .. '</div>'
	else
		return '<div role="note" style="font-style: italic;">This article incorporates text from the public domain [[Pfam]] and [[InterPro]] ' .. renderList(args) .. '</div>'
	end
end

return p