|
|
Строка 11: |
Строка 11: |
| -- Variables | | -- Variables |
| local modules = {}; | | local modules = {}; |
|
| |
| -- Helpers
| |
| local function formatProject( frame, item )
| |
| local out = '';
| |
| local context = frame;
| |
|
| |
| if item['module'] ~= nil and item['function'] ~= nil then
| |
| if modules[item['module']] == nil then
| |
| modules[item['module']] = require( 'Module:' .. item['module'] );
| |
| end
| |
| if item['args'] ~= nil then
| |
| context.args = item['args'];
| |
| end
| |
| item.wikiValue = ( context );
| |
| -- add wiki prefix
| |
| if item.wikiValue ~= nil and item.wikiValue ~= '' and item.wikiPrefix ~= nil and item.wikiPrefix ~= '' then
| |
| item.wikiValue = item.wikiPrefix.. ':' .. item.wikiValue;
| |
| end
| |
| -- override value if local value does not exist
| |
| if item.value == nil or item.value == '' then
| |
| item.value = item.wikiValue;
| |
| end
| |
| end
| |
|
| |
| if item.value ~= nil and item.value ~= '' then
| |
| -- replace variables
| |
| if item.title ~= nil and item.title ~= '' then
| |
| item.title = string.gsub( item.title, '%$1', item.value );
| |
| end
| |
| -- format image
| |
| if item.imageTemplate ~= nil and item.imageTemplate ~= '' then
| |
| item.imageFormatted = frame:expandTemplate{ title = item.imageTemplate, args = { item.value, size = config.params.itemImageSize } };
| |
| elseif item.image ~= nil and item.image ~= '' then
| |
| item.imageFormatted = '[[File:' .. item.image .. '|link=|alt=|' .. config.params.itemImageSize .. 'px]]';
| |
| end
| |
| -- format wikilink
| |
| out = out
| |
| end
| |
|
| |
| return out;
| |
| end
| |
|
| |
|
| local function getParamsList( frame, args, list ) | | local function getParamsList( frame, args, list ) |