Module:InterPro content: Difference between revisions

Content deleted Content added
args
use module:list
 
(11 intermediate revisions by 3 users not shown)
Line 1:
local getArgs = require('Module:Arguments').getArgs
 
local beginText = 'This article incorporates text from the public ___domain [[Pfam]] and [[InterPro]]: '
returnlocal baseUrl = '[https://www.ebi.ac.uk/interpro/entry/' .. entry .. ' ' .. entry .. ']'
 
local p = {}
 
local function interproLink(entryarg)
-- text before first space, if any; otherwise, whole arg
return '[https://www.ebi.ac.uk/interpro/entry/' .. entry .. ' ' .. entry .. ']'
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 listRootlist_args = mw.html.create('ul'){
class = 'inline'
:addClass('hlist')
}
 
for _, ea in ipairs(args) do
table.insert(list_args, interproLink(a))
listRoot
:tag('li')
:wikitext(interproLink(e))
end
 
return require('Module:List').horizontal(list_args)
return listRoot
end
 
Line 26 ⟶ 33:
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]] 'beginText .. interproLink(args[1]) .. '</div>'
else
return '<div role="note" style="font-style: italic;">This' article.. incorporates text from the public ___domain [[Pfam]] and [[InterPro]] 'beginText .. renderList(args) .. '</div>'
end
end