پودمان:Ayat-Navigator
توضیحات این پودمان میتواند در پودمان:Ayat-Navigator/توضیحات قرار گیرد.
require('strict')
local p = {}
local args = {}
local num_con = require('Module:Numeral converter').convert
local getArgs = require('Module:Arguments').getArgs
--local cfg = mw.loadData('Module:Ayat-Navigator/configs')
local function getData(sure)
local title = mw.title.new('Module:Ayat-Navigator/' .. sure)
if not (title and title.exists) then return nil end
return require('Module:Ayat-Navigator/' .. sure)
end
function p.named_gen(frame)
local listitems = ""
args = getArgs(frame)
local sure_num = args["sure_num"]
if getData(num_con("en", sure_num)) then
local data = getData(num_con("en", sure_num))
if data.ayat_namdar then
for k, v in pairs(data.ayat_namdar) do
listitems = listitems .. '\n* ' .. v
end
end
end
return listitems
end
function p.ayat_gen(frame)
local listitems = ""
args = getArgs(frame)
local aye_num = num_con("en", args["aye_num"])
local sure_num = num_con("en", args["sure_num"])
local sure = args["sure"]
if getData(sure_num) then
local data = getData(sure_num)
if tonumber(aye_num) then
for i = 1, tonumber(data.lengths[sure_num]) do
listitems = listitems ..
'\n* [[آیه ' .. num_con("fa", i) .. ' سوره ' .. sure .. '|'
.. num_con("fa", i) .. ']]'
end
end
end
return listitems
end
function p.mortabet(frame)
local listitems = ""
args = getArgs(frame)
local sure_num = args["sure_num"]
if getData(num_con("en", sure_num)) then
local data = getData(num_con("en", sure_num))
if data.mortabet then
for k, v in pairs(data.mortabet) do
listitems = listitems .. '\n* ' .. v
end
end
end
return listitems
end
return p