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 20:18, 30 August 2018 (lua version of Template:InterPro content to allow multiple links in a single list). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

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

local function generate_list(args)
	local list_root = mw.html.create('ul')
		:addClass('hlist')

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

	return list_root
end

local p = {}

function p.list(frame)
	if #frame['args'] == 1 then
		return '<div role="note" style="font-style: italic;">This article incorporates text from the public domain [[Pfam]] and [[InterPro]] ' .. interpro_link(frame['args'][1]) .. '</div>'
	elseif #frame['args'] > 1 then
		return '<div role="note" style="font-style: italic;">This article incorporates text from the public domain [[Pfam]] and [[InterPro]] ' .. generate_list(frame['args']) .. '</div>'
	else
		return '<div class="error">[[Module:InterPro content]]: bad number of arguments</div>'
	end
end

return p