مسابقه دانش‌دخت
اسلامیکال از تاریخ ۱۵ دی تا ۲۰ بهمن، میزبان یک همایه با موضوع زنان است. شما می‌توانید در مسابقه مقاله‌نویسی دانش‌دخت، شرکت کنید و با نگارش مقاله، از جوایز آن بهره‌مند باشید. اگر به موضوعات مربوط با زنان علاقه‌مندید، این فرصت را از دست ندهید. فهرستی از مقالات پیشنهادی جهت ایجاد یا ویرایش در اینجا وجود دارد.

پودمان:Ayat-Navigator: تفاوت میان نسخه‌ها

از اسلامیکال
پرش به ناوبری پرش به جستجو
(getData for lengths)
(get_hezb + get_joze)
خط ۸: خط ۸:
--local cfg = mw.loadData('Module:Ayat-Navigator/configs')
--local cfg = mw.loadData('Module:Ayat-Navigator/configs')


local function getData(sure, len)
local function getData(sure, data_type)
if (len==true) then
if (data_type=="len") then
return require('Module:Ayat-Navigator/Sure-Lengths')
return require('Module:Ayat-Navigator/Sure-Lengths')
end
if (data_type=="joze_hezb") then
return require('Module:Ayat-Navigator/Joze-Hezb')
end
end
خط ۲۵: خط ۲۹:
local sure_num = args["sure_num"]
local sure_num = args["sure_num"]


if getData(num_con("en", sure_num), false) then
if getData(num_con("en", sure_num), "ayat_data") then
local data = getData(num_con("en", sure_num), false)
local data = getData(num_con("en", sure_num), "ayat_data")


if data.ayat_namdar then
if data.ayat_namdar then
خط ۴۷: خط ۵۱:
local sure = args["sure"]
local sure = args["sure"]
if getData(sure_num, true) then
if getData(sure_num, "len") then
local data = getData(sure_num, true)
local data = getData(sure_num, "len")
if tonumber(aye_num) then
if tonumber(aye_num) then
خط ۶۹: خط ۷۳:
local sure_num = args["sure_num"]
local sure_num = args["sure_num"]


if getData(num_con("en", sure_num), false) then
if getData(num_con("en", sure_num), "ayat_data") then
local data = getData(num_con("en", sure_num), false)
local data = getData(num_con("en", sure_num), "ayat_data")
if data.mortabet then
if data.mortabet then
خط ۸۰: خط ۸۴:
return listitems
return listitems
end
local function hezb_calculator(surenum, ayenum)
if getData(surenum, "joze_hezb") then
local data = getData(surenum, "joze_hezb")
local hezbs = data.hezbs
for i= 1, 120 do
local hezb_ini_sure = tonumber(hezbs[i].AzAvaleAye[1])
local hezb_fin_sure = tonumber(hezbs[i].TaAkharAye[1])
local hezb_ini_aye = tonumber(hezbs[i].AzAvaleAye[2])
local hezb_fin_aye = tonumber(hezbs[i].TaAkharAye[2])
if (hezb_ini_sure <= surenum) and
  (hezb_fin_sure >= surenum) and
  (hezb_ini_sure == hezb_fin_sure) then
  if (hezb_ini_aye <= ayenum) and
      (hezb_fin_aye >= ayenum) then
      return i
      end
    elseif (hezb_ini_sure <= surenum) and
      (hezb_fin_sure >= surenum) and
      (hezb_ini_sure < hezb_fin_sure) then
              if (surenum == hezb_ini_sure) then
                  if (hezb_ini_aye <= ayenum) then
                    return i
                  end
              elseif (surenum > hezb_ini_sure) and
                    (surenum < hezb_fin_sure) then
                    return i
              elseif (surenum == hezb_fin_sure) then
                    if (ayenum <= hezb_fin_aye) then
                      return i
                    end
              end
        end
end
end
end
function p.get_hezb(frame)
args = getArgs(frame)
local aye_num = tonumber(num_con("en", args["aye_num"]))
local sure_num = tonumber(num_con("en", args["sure_num"]))
return hezb_calculator(sure_num, aye_num)
end
function p.get_joze(frame)
args = getArgs(frame)
local aye_num = tonumber(num_con("en", args["aye_num"]))
local sure_num = tonumber(num_con("en", args["sure_num"]))
if getData(sure_num, "joze_hezb") then
local data = getData(sure_num, "joze_hezb")
local hezbs = data.hezbs
local hezb = hezb_calculator(sure_num, aye_num)
for i= 1, 120 do
if (hezb == i) then
return hezbs[i].JozeHezb[1]
end
end
end
end
end


return p
return p

نسخهٔ ‏۶ ژوئن ۲۰۲۳، ساعت ۲۱:۵۳

توضیحات این پودمان می‌تواند در پودمان: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, data_type)
	if (data_type=="len") then
		return require('Module:Ayat-Navigator/Sure-Lengths')
	end
	
	if (data_type=="joze_hezb") then
		return require('Module:Ayat-Navigator/Joze-Hezb')
	end
	
	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), "ayat_data") then
		local data = getData(num_con("en", sure_num), "ayat_data")

		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, "len") then
		local data = getData(sure_num, "len")
		
		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), "ayat_data") then
		local data = getData(num_con("en", sure_num), "ayat_data")
		
		if data.mortabet then
			for k, v in pairs(data.mortabet) do
				listitems = listitems .. '\n* ' .. v
			end
		end
	end
	
	return listitems
end

local function hezb_calculator(surenum, ayenum)
	if getData(surenum, "joze_hezb") then
		local data = getData(surenum, "joze_hezb")
		local hezbs = data.hezbs
		
		for i= 1, 120 do
			local hezb_ini_sure = tonumber(hezbs[i].AzAvaleAye[1])
			local hezb_fin_sure = tonumber(hezbs[i].TaAkharAye[1])
			local hezb_ini_aye = tonumber(hezbs[i].AzAvaleAye[2])
			local hezb_fin_aye = tonumber(hezbs[i].TaAkharAye[2])
			
			if (hezb_ini_sure <= surenum) and
			   (hezb_fin_sure >= surenum) and
			   (hezb_ini_sure == hezb_fin_sure) then
			   if (hezb_ini_aye <= ayenum) and
			      (hezb_fin_aye >= ayenum) then
			      return i
		       end
		    elseif (hezb_ini_sure <= surenum) and
			       (hezb_fin_sure >= surenum) and
			       (hezb_ini_sure < hezb_fin_sure) then
	               if (surenum == hezb_ini_sure) then
	                  if (hezb_ini_aye <= ayenum) then
	                     return i
	                  end
	               elseif (surenum > hezb_ini_sure) and
	               	      (surenum < hezb_fin_sure) then
	               	      return i
	               elseif (surenum == hezb_fin_sure) then
	           	          if (ayenum <= hezb_fin_aye) then
	               	         return i
	               	      end
	               end
	        end
		end
	end
end

function p.get_hezb(frame)
	args = getArgs(frame)
	
	local aye_num = tonumber(num_con("en", args["aye_num"]))
	local sure_num = tonumber(num_con("en", args["sure_num"]))
	
	return hezb_calculator(sure_num, aye_num)
end

function p.get_joze(frame)
	args = getArgs(frame)
	
	local aye_num = tonumber(num_con("en", args["aye_num"]))
	local sure_num = tonumber(num_con("en", args["sure_num"]))

	if getData(sure_num, "joze_hezb") then
		local data = getData(sure_num, "joze_hezb")
		local hezbs = data.hezbs
		local hezb = hezb_calculator(sure_num, aye_num)
		
		for i= 1, 120 do
			if (hezb == i) then
				return hezbs[i].JozeHezb[1]
			end
		end
	end
end

return p