Jump to content

Module:ConvertDigit

ꯋꯤꯀꯤꯄꯦꯗꯤꯌꯥ ꯗꯒꯤ

Documentation for this module may be created at Module:ConvertDigit/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 en_months = {
	['January'] = 'ꯖꯥꯅꯨꯋꯥꯔꯤ',
	['january'] = 'ꯖꯥꯅꯨꯋꯥꯔꯤ',
	['February'] = 'ꯐꯦꯕꯔꯨꯋꯥꯔꯤ',
	['february'] = 'ꯐꯦꯕꯔꯨꯋꯥꯔꯤ',
	['March'] = 'ꯃꯥꯔꯆ',
	['march'] = 'ꯃꯥꯔꯆ',
	['April'] = 'ꯑꯦꯄꯔꯤꯜ',
	['april'] = 'ꯑꯦꯄꯔꯤꯜ',
	['May'] = 'ꯃꯦ',
	['may'] = 'ꯃꯦ',
	['June'] = 'ꯖꯨꯟ',
	['june'] = 'ꯖꯨꯟ',
	['July'] = 'ꯖꯨꯂꯥꯏ',
	['july'] = 'ꯖꯨꯂꯥꯏ',
	['August'] = 'ꯑꯒꯁ꯭ꯇ',
	['august'] = 'ꯑꯒꯁ꯭ꯇ',
	['September'] = 'ꯁꯦꯞꯇꯦꯝꯕꯔ',
	['september'] = 'ꯁꯦꯞꯇꯦꯝꯕꯔ',
	['October'] = 'ꯑꯣꯛꯇꯣꯕꯔ',
	['october'] = 'ꯑꯣꯛꯇꯣꯕꯔ',
	['November'] = 'ꯅꯣꯚꯦꯝꯕꯔ',
	['november'] = 'ꯅꯣꯚꯦꯝꯕꯔ',
	['December'] = 'ꯗꯤꯁꯦꯝꯕꯔ',
	['december'] = 'ꯗꯤꯁꯦꯝꯕꯔ',
}

local function _main(input)
	-- Callable from another module.
	input = input or ''
	return (input:gsub('%a+', en_months):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 }
"https://mni.wikipedia.org/w/index.php?title=Module:ConvertDigit&oldid=38788" ꯃꯐꯝꯗꯨꯗꯒꯤ ꯂꯧꯈꯠꯂꯛꯄꯥ