"ମଡ୍ୟୁଲ:ConvertDigit" ପୃଷ୍ଠାର ସଂସ୍କରଣ‌ଗୁଡ଼ିକ ମଧ୍ୟରେ ତଫାତ

Content deleted Content added
ଟିକେNo edit summary
ଟ୍ୟାଗ: Reverted
ଟିକେ Jnanaranjan sahu (ଆଲୋଚନା)ଙ୍କ ଦେଇ କରାଯାଇଥିବା ବଦଳକୁ Snip1ଙ୍କ ଦେଇ କରାଯାଇଥିବା ଶେଷ ବଦଳକୁ ଫେରାଇ ଦିଆଗଲା
ଟ୍ୟାଗ: Rollback
 
୧ କ ଧାଡ଼ି:
 
-- First, define a table of text to search for, and what to convert it to.
local en_digitsconvertDigitOnly = {
['0'] = '୦',
['1'] = '୧',
୨୭ କ ଧାଡ଼ି:
}
 
local en_monthsconversionTable = {
['January'] = 'ଜାନୁଆରୀ',
['February'] = 'ଫେବୃଆରୀ',
୬୮ କ ଧାଡ଼ି:
['9'] = '୯',
}
 
local function _main(input)
-- Then we define a table to hold our function
-- Callable from another module.
local p = {}
input = input or ''
 
return (input:gsub('%a+', en_months):gsub('%d', en_digits))
-- define a function that converts english digits to Odia digits only nothing else.
local function mainp.En2ordigit(frame)
local s = frame.args[1] -- This gets the first positional argument.
for en, odia in pairs(convertDigitOnly) do -- This converts every digit found in the table.
s = mw.ustring.gsub(s, en, odia)
end
return s -- Get the result of the function.
end
 
-- define a function that converts Odia digits to English digits only nothing else.
local function main(frame)
function p.Or2endigit(frame)
-- Callable from #invoke or from a template.
local s = frame.args[1] -- This gets the first positional argument.
return _main(frame.args[1] or frame:getParent().args[1])
for en, odia in pairs(Odia2EngDigitOnly) do -- This converts every digit found in the table.
s = mw.ustring.gsub(s, en, odia)
end
return s -- Get the result of the function.
end
 
-- Then we define a function that converts strings using conversionTable.
return { main = main, _main = _main }
function p.main(frame)
local s = frame.args[1] -- This gets the first positional argument.
for en, odia in pairs(conversionTable) do -- This converts every string found in the table.
s = mw.ustring.gsub(s, en, odia)
end
return s -- Get the result of the function.
end
 
return p -- Pass our table containing our function back to Lua.
-- Now we can call our function using {{#invoke:ConvertDigit|main|<!-- your text here
 
-->}}.