Modul:Biblia

De la Wikipedia, enciclopedia liberă

Documentația acestui modul poate fi creată la Modul:Biblia/doc

local getArgs = require('Modul:Arguments').getArgs
local roman = require('Modul:Roman')._main
local p = {}
local old = {} --TODO
local new = {'Matei', 'Marcu', 'Luca', 'Ioan', 'Faptele Apostolilor', 'Romani', 'Corinteni', 'Galateni', 'Efeseni', 'Filipeni', 'Coloseni', 'Tesaloniceni', 'Timotei', 'I Timotei', 'II Timotei', 'Tit', 'Filimon', 'Evrei', 'Iacob', 'Petru', 'I Ioan', 'II Ioan', 'Iuda', 'Apocalipsa'}

function p.bibleverse(frame)
	local args = getArgs(frame, { frameOnly = false })
	mw.logObject(args)
	local param = 1
	if args["ver"] == "2" then param = 2 end
	local count = ''
	local book = ''
	local num = tonumber(args[1])
	if version == 2 then
		if args[1] and num then 
			count = roman(args)
			if count == 'N' then count = '' else count = count .. ' ' end
		elseif args[1] then
			book = args[1] .. ' '
		end
	end
	mw.logObject(count)
	if args[param] == nil or args[param] == '' then param = param + 1 end
	local link = '[[:s:Biblia/'
	local book = book .. args[param]
	local chapter = args[param + 1]
	local verse = args[param + 2]
	if not verse then verse = '' end
	s = mw.ustring.find(chapter, ':')
	if s then
		verse = string.sub(chapter, s+1)
		chapter = string.sub(chapter, 1, s-1)
	end
	for _,v in ipairs(new) do
		if v == book then 
			link = link .. 'Noul_Testament/' .. count .. book
			break
		end
	end
	if #link == 12 then
		link = link .. 'Vechiul_Testament/' .. book
	end
	link = link .. '/Capitolul_' .. chapter .. '|' .. count .. book .. ' ' .. chapter .. ':' .. verse .. ']]'
	return link
end

return p