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

Новая страница: «--This module convert strings to numbers. local p = {} -- Get first integer number from string. function p.integer( frame ) local s = frame.args[1] s = string.gsub( s, '<[^<>]+>', '' ) -- strip HTML tags s = string.gsub( s, '[^0-9]', ' ' ) s = mw.text.trim( s ) s = mw.text.split( s, ' ' )[1] return tonumber( s ) end -- Get number from quantity (e.g. from Wikidata). function p.quantity( frame ) local s = frame.args[1] s...»
 
Нет описания правки
 
Строка 86: Строка 86:
    if isBce then
    if isBce then
    if cat then
    if cat then
    return '[[К:' .. cat .. ' ' .. n .. ' ' .. yearForm .. ' до н. э.]]'
    return '[[Категория:' .. cat .. ' ' .. n .. ' ' .. yearForm .. ' до н. э.]]'
    end
    end
    n = -n
    n = -n
    else
    else
    if cat then  
    if cat then  
    return '[[К:' .. cat .. ' ' .. n .. ' ' .. yearForm .. ']]'
    return '[[Категория:' .. cat .. ' ' .. n .. ' ' .. yearForm .. ']]'
    end
    end
    end
    end