Модуль:Отображение упоминаний
Перейти к навигации
Перейти к поиску
Для документации этого модуля может быть создана страница Модуль:Отображение упоминаний/doc
local pp = {}
local tools = require( 'Module:Tools' )
local refTools = require( 'Module:RefTools' )
function pp.display( query, queryCount, showP )
if queryCount == 0 then
return '<i></i>'
end
table.sort( query, function ( a, b )
return ( a.cDate or '' ) < ( b.cDate or '' )
end
)
local out = { [==[
<p class="nkvd-mention">Упоминается в следующих материалах:</p>
<ul class="nkvd-mention">
]==] }
for _, row in ipairs( query ) do
if row['#eq'] or ( showP and row['#ap'] ) then
table.insert( out, '<li class="nkvd-mebtion">' )
-- local doc = mw.title.new( row._pageName )
-- table.insert( out, '[[' .. doc.prefixedText .. '|' .. doc.text .. ']]' )
local doc, persdoc = row._pageName, (row.alias or '')
if persdoc == '' then
persdoc = mw.title.new( doc ).text
end
table.insert( out, '[[' .. doc .. '|' .. persdoc .. ']]' )
table.insert( out, refTools.makeRef( row.reference ) )
table.insert( out, ' — ' .. row.comment )
end
table.insert( out, '</li>\n' )
end
table.insert( out, '</ul>' )
return table.concat( out )
end
return pp