Модуль:Конец анкеты/Партии
Перейти к навигации
Перейти к поиску
Для документации этого модуля может быть создана страница Модуль:Конец анкеты/Партии/doc
local pp = {}
local global = mw.ext.luaglobal
local tools = require( 'Модуль:Tools' )
global.strict( true )
local function diap( start, stop )
if start and stop then
return ' ' .. tools.reparseDate( start ) .. '−' .. tools.reparseDate( stop )
end
if start then
return ' c ' .. tools.reparseDate( start )
end
if stop then
return ' дo ' .. tools.reparseDate( stop )
end
return ''
end
return function ()
local gKPSS = global.get( 'gKPSS' )
local gVLKSM = global.get( 'gVLKSM' )
local gBund = global.get( 'gBund' )
local outKPSS, outVLKSM, outBund = {}, {}
if gKPSS or gVLKSM or gBund then
local out = {}
local outChap, tmp, last
table.insert( out, '<p class="nkvd-party">' )
if gKPSS then
outChap = {}
last = ''
for _, KPSS in ipairs( gKPSS ) do
if KPSS['флаг'] == 2 or (KPSS['член'] or '') ~= '' then
if last == 'член' then
tmp = diap( KPSS['член'], KPSS['выбыл'] )
else
tmp = 'член ВКП(б)' .. diap( KPSS['член'], KPSS['выбыл'] )
last = 'член'
end
if KPSS['кандидат'] then
tmp = tmp .. ', кандидат с ' .. tools.reparseDate( KPSS['кандидат'] )
last = ''
end
elseif KPSS['флаг'] == 1 or KPSS['кандидат'] then
tmp = 'кандидат в члены ВКП(б)' .. diap( KPSS['кандидат'], KPSS['выбыл'] )
elseif KPSS['флаг'] == -1 then
tmp = 'беспартийный'
else
return tools.errorMsg( 'КПСС', 'Противоречивая информация в шаблоне' )
end
table.insert( outChap, tmp .. tools.commonParams(
KPSS['дополнение'], KPSS['сноска'], KPSS['источник'] ) )
end
table.insert( out, tools.phrase( table.concat(outChap, '; ') ) )
outKPSS = { gKPSS[1]['флаг'], gKPSS[1]['кандидат'], gKPSS[1]['член'], gKPSS[#gKPSS]['выбыл'] }
if #gKPSS == 1 then
outKPSS[5] = gKPSS[1]['дополнение']
else
outKPSS[5] = out[#out]
end
else
outKPSS = { }
end
if gVLKSM then
if gVLKSM[1]['флаг'] == -1 then
outVLKSM = { }
table.insert( out, 'В комсомоле не состоял.' )
else
outChap = {}
tmp = ''
for _, VLKSM in ipairs( gVLKSM ) do
if VLKSM['флаг'] ~= -1 then
tmp = diap( VLKSM['член'], VLKSM['выбыл'] )
else
return tools.errorMsg ('ВЛКСМ', 'Шаблоны не консистентны')
end
table.insert( outChap, tmp .. tools.commonParams(
VLKSM['дополнение'], VLKSM['сноска'], VLKSM['источник'] ) )
end
table.insert( out, 'Состоял в комсомоле' .. table.concat(outChap, '; ') .. '.' )
outVLKSM = { gVLKSM[1]['флаг'], gVLKSM[1]['член'], gVLKSM[#gVLKSM]['выбыл'] }
if #gVLKSM == 1 then
outVLKSM[4] = gVLKSM[1]['дополнение']
else
outVLKSM[4] = out[#out]
end
end
end
if gBund then
outChap = {}
for _, Bund in ipairs( gBund ) do
table.insert( outChap, Bund['партия'] .. diap( Bund['член'], Bund['выбыл'] )
.. tools.commonParams(
Bund['дополнение'], Bund['сноска'], Bund['источник'] ) )
end
table.insert( out, 'Участие в иных партиях: ' .. table.concat(outChap, '; ') .. '.' )
outBund = { out[#out] }
else
outBund = { }
end
return table.concat( out, ' ' ) .. '</p>', outKPSS, outVLKSM, outBund
else
return '', {}, {}, {}
end
end