Модуль:Предмет: различия между версиями
Pok (обсуждение | вклад) Нет описания правки |
Pok (обсуждение | вклад) Нет описания правки |
||
| (не показаны 2 промежуточные версии этого же участника) | |||
| Строка 13: | Строка 13: | ||
local function wrapLink(text, target) | local function wrapLink(text, target) | ||
return (text ~= '' and target and string.format('[[%s|%s]]', target, text) or text) | return (text ~= '' and target and string.format('[[%s|%s]]', target, text) or text) | ||
end | end | ||
| Строка 38: | Строка 31: | ||
local isVert = argsRaw.vertical ~= nil | local isVert = argsRaw.vertical ~= nil | ||
-- Если id найден в JsonPaths, префиксы проекта нужны | |||
local | local hasId = (JsonPaths.has(id) == true) | ||
local projPrefix = | local projPrefix = hasId and JsonPaths.prefix() or '' | ||
local projPrefixFile = hasId and JsonPaths.prefixFile() or '' | |||
-- Получение имени | -- Получение имени | ||
| Строка 61: | Строка 55: | ||
-- Изображение | -- Изображение | ||
local imgFile = argsRaw.image or argsRaw.img or (id .. '.png') | local imgFile = argsRaw.image or argsRaw.img or (id .. '.png') | ||
if imgFile ~= '' and | if imgFile ~= '' and projPrefixFile ~= '' then | ||
imgFile = | imgFile = projPrefixFile .. imgFile | ||
end | end | ||