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

Нет описания правки
Нет описания правки
 
(не показаны 2 промежуточные версии этого же участника)
Строка 3: Строка 3:


local DEFAULT_VALUE = 'Corvax, Goob'
local DEFAULT_VALUE = 'Corvax, Goob'
local SPECIAL_SKIP_VALUE = 'Corvax'


local function trim(s)
local function trim(s)
Строка 18: Строка 17:
end
end
return out
return out
end
local function isSkipValue(value)
return mw.ustring.lower(trim(value)) == mw.ustring.lower(SPECIAL_SKIP_VALUE)
end
end


Строка 34: Строка 29:


local first = projects[1]
local first = projects[1]
if isSkipValue(first) then
local result = ''
return ''
result = result .. '{{#vardefine:JsonPath|' .. first .. '}}'
end
 
local result = '{{#vardefine:JsonPath|' .. first .. '}}'
if #projects == 1 then
return result
end
 
result = result .. '<div style="display:none;" class="js-project-selection-generator">'
result = result .. '<div style="display:none;" class="js-project-selection-generator">'
.. mw.text.encode(table.concat(projects, ', '))
.. mw.text.encode(table.concat(projects, ', '))