সমললৈ যাওক

Module:ConvertDigit(As2En)

অসমীয়া ৱিকিপিডিয়াৰ পৰা

Documentation for this module may be created at Module:ConvertDigit(As2En)/doc

-- Return input text after converting any en digits and month names.

local en_digits = {
	['০'] = '0',
	['১'] = '1',
	['২'] = '2',
	['৩'] = '3',
	['৪'] = '4',
	['৫'] = '5',
	['৬'] = '6',
	['৭'] = '7',
	['৮'] = '8',
	['৯'] = '9',
}

local function _main(input)
	-- Callable from another module.
	input = input or ''
	return (input:gsub('%d', en_digits))
end

local function main(frame)
	-- Callable from #invoke or from a template.
	return _main(frame.args[1] or frame:getParent().args[1])
end

return { main = main, _main = _main }