Модуль:Предмет: различия между версиями

Нет описания правки
Нет описания правки
Строка 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
local function projectPrefix(project)
if project ~= '' then
return project .. ':'
end
return ''
end
end


Строка 38: Строка 31:
local isVert = argsRaw.vertical ~= nil
local isVert = argsRaw.vertical ~= nil


local project = JsonPaths.project(argsRaw.path or '')
local projPrefix = JsonPaths.prefix()
local useProject = (project ~= '' and id ~= '' and JsonPaths.has(id, project) == true)
local projPrefixFile = JsonPaths.prefixFile()
local projPrefix = useProject and projectPrefix(project) or ''


-- Получение имени
-- Получение имени
Строка 61: Строка 53:
-- Изображение
-- Изображение
local imgFile = argsRaw.image or argsRaw.img or (id .. '.png')
local imgFile = argsRaw.image or argsRaw.img or (id .. '.png')
if imgFile ~= '' and projPrefix ~= '' then
if imgFile ~= '' and projPrefixFile ~= '' then
imgFile = projPrefix .. imgFile
imgFile = projPrefixFile .. imgFile
end
end