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

Новая страница: «local p = {} local getArgs = require('Module:Arguments').getArgs function p.main(frame) local args = getArgs(frame, { removeBlanks = false }) local value = args[1] if not value then return "" end local num = tonumber(value) local color = num and (num > 0 and "good" or "bad") or "text" local amt = num and ((num > 0) and ("+" .. num) or tostring(num)) or tostring(value) return frame:preprocess(string.format("{{цвет|t...»
 
Нет описания правки
 
Строка 9: Строка 9:
     end
     end


    local invert = args.invert
     local num = tonumber(value)
     local num = tonumber(value)
     local color = num and (num > 0 and "good" or "bad") or "text"
 
     local color
    if num then
        if invert then
            color = num > 0 and "bad" or "good"
        else
            color = num > 0 and "good" or "bad"
        end
    else
        color = "text"
    end
 
     local amt = num and ((num > 0) and ("+" .. num) or tostring(num)) or tostring(value)
     local amt = num and ((num > 0) and ("+" .. num) or tostring(num)) or tostring(value)