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

Content deleted Content added
ଶିତିକଣ୍ଠ ଦାଶ (ଆଲୋଚନା) ଙ୍କ ଦେଇ କରାଯାଇଥିବା 323431 ସଙ୍କଳନଟି ପଛକୁ ଫେରାଇନିଆଗଲା
ଟିକେNo edit summary
ଟ୍ୟାଗ: Reverted
୧ କ ଧାଡ଼ି:
 
-- First, define a table of text to search for, and what to convert it to.
local convertDigitOnlyen_digits = {
['0'] = '୦',
['1'] = '୧',
୨୭ କ ଧାଡ଼ି:
}
 
local conversionTableen_months = {
['January'] = 'ଜାନୁଆରୀ',
['February'] = 'ଫେବୃଆରୀ',
୬୮ କ ଧାଡ଼ି:
['9'] = '୯',
}
local function _main(input)
 
-- Callable from another module.
-- Then we define a table to hold our function
input = input or ''
local p = {}
return (input:gsub('%a+', en_months):gsub('%d', en_digits))
 
-- define a function that converts english digits to Odia digits only nothing else.
function p.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
 
local function p.En2ordigitmain(frame)
-- define a function that converts Odia digits to English digits only nothing else.
-- Callable from #invoke or from a template.
function p.Or2endigit(frame)
return _main(frame.args[1] or frame:getParent().args[1])
local s = frame.args[1] -- This gets the first positional argument.
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
 
return { main = main, _main = _main }
-- Then we define a function that converts strings using conversionTable.
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
 
-->}}.