Модуль:Родственные проекты: различия между версиями
[досмотренная версия] | [досмотренная версия] |
Содержимое удалено Содержимое добавлено
Putnik (обсуждение | вклад) |
Обслуживание |
||
Строка 2:
-- Configuration data
local config = require('
-- Modules
local getArgs = require('Module:Arguments').getArgs;
local errorMsg = require('Module:Error').error;
local yesno = require('Module:Yesno');
Строка 47 ⟶ 48 :
item.imageFormatted = frame:expandTemplate{ title = item['image-template'], args = { item.value, size = config.params.itemImageSize } };
elseif item.image ~= nil and item.image ~= '' then
item.imageFormatted = '[[
end
-- format wikilink
Строка 80 ⟶ 81 :
for i, item in ipairs( list ) do
-- wrapper
local li = res:tag( 'li' )
:addClass( config.params.tsClass .. '-item' );
-- class
local class = '';
Строка 91 ⟶ 93 :
if item.imageFormatted ~= nil and item.imageFormatted ~= '' then
li:tag( 'span' )
:addClass( config.params.tsClass .. '-image' )
:wikitext( item.imageFormatted );
end
-- formatted value
li:tag( 'span' )
:addClass( config.params.tsClass .. '-label' )
:addClass( class )
:wikitext( item.formatted );
Строка 103 ⟶ 105 :
return res;
end
local function renderPreview( frame )▼
local res = mw.html.create( 'div' )▼
:addClass( 'hatnote' )▼
:wikitext( config.strings['preview-error'] );▼
return res;▼
end;▼
local function render( frame, title, interprojects, otherprojects )
Строка 120 ⟶ 114 :
:wikitext( templateStyles );
local body = res:tag( 'div' )
:addClass( config.params.bodyClass );
-- render title
if table.getn( interprojects ) > 1 and ( title == nil or title == '' ) then
title = config.strings['title'];▼
end
if title ~= nil and title ~= '' then▼
body:tag( 'div' )
:addClass( config.params.tsClass .. '
:wikitext( "'''" .. title .. "'''" );
end
Строка 147 ⟶ 145 :
-- Categories
local function formatCategory( value )
return '[[
end
Строка 171 ⟶ 169 :
local category = formatCategory( categoryItem['equal'] )
table.insert( categories, category );
end
-- category for non existing pages
if categoryItem['not_exists'] ~= nil then
local page = mw.title.new( item.value, item.prefix );
if not page.exists then
local category = formatCategory( categoryItem['not_exists'] )
table.insert( categories, category );
end
end
end
Строка 195 ⟶ 201 :
return res;
end
-- Preview
▲local function renderPreview( frame )
if config.strings['preview-error'] ~= nil and config.strings['preview-error'] ~= '' then
res:wikitext( message );
end
▲ return res;
▲end;
-- Main
Строка 201 ⟶ 217 :
local nocat = yesno( args['nocat'] );
-- title parameter
local title =
for i, item in ipairs( config.title.id ) do
▲ if title ~= nil then
if args[item] ~= nil and args[item] ~= '' then
title = args[item];
end
end
if title ~= nil and title ~= '' then
title = title .. ':'
▲ title = config.strings['title'];
end
-- get parameters list
|