Модуль:Ведомости
Перейти к навигации
Перейти к поиску
Для документации этого модуля может быть создана страница Модуль:Ведомости/doc
local p ={}
local tools = require( 'Модуль:Tools' )
local function gazeta( frame, title, vedlink )
local args = frame:getParent().args
local year, num, form = tools.parseDate( mw.text.trim( args[1] ) ), args[2] or '' , mw.text.trim( args[3] or '' )
local lnum, tnum = string.match( num, '^%s*(%d+)%s*%(%s*(%d+)%s*%)%s*$' )
if lnum then
lnum = tonumber( lnum )
tnum = tonumber( tnum )
else
lnum = tonumber( num )
end
if not lnum then
lnum = 0
end
if ( year or '' ) == '' then -- or not lnum then
return '<span class=error> Ошибка в ссылке на '.. title .. '. </span>'
end
local date
if #year ~= 4 then
date, year = tools.reparseDate( year ), string.sub( year, 1, 4)
end
local u
if vedlink then
vedlink = mw.loadData( 'Модуль:Ведомости/' .. vedlink )
u = vedlink[year..':'..lnum] or {}
else
u = {}
end
-- local u = vedlink[year..':'..lnum] or {}
date = date or u.date
tnum = tnum or u.tnum
if not date then
date = year
end
if tnum then
lnum = lnum .. ' (' .. tnum .. ')'
end
-- local text = '«Ведомости Верховного Совета СССР», ' .. date .. ', № ' .. lnum
local text
if lnum ~= 0 then
text = '№ ' .. lnum .. ', ' .. date
else
text = date
end
local link = u.link
if link then
link = 'https://drive.google.com/uc?export=view&id=' .. link
end
if form == '-' then
if link then
return link
else
return '<span class=error> Запрос несуществующей ссылки на '.. title .. '. </span>'
end
end
local prefix = ''
if form == '' then
prefix = title .. ', '
elseif form ~= 'N' and form ~='№' then
text = form
end
if link then
return prefix .. '[' .. link .. ' ' .. text .. ']'
else
return prefix .. text
end
end
function p.Ved( frame )
return gazeta( frame, '«Ведомости Верховного Совета СССР»', 'ved')
end
function p.Izv( frame )
return gazeta( frame, '«Известия ЦИК Союза ССР и ВЦИК»' )
end
function p.IzvG( frame )
return gazeta( frame, '«Известия»', 'izvG' )
end
function p.KZ( frame )
return gazeta( frame, '«Красная звезда»', 'kz' )
end
return p