Module:Cite Talmud

local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:yesno')

local function tidyVal(key, val)
	if type(val) == 'string' then
		val = val:gsub(" ", ' '):match('^%s*(.-)%s*$')
		if val == '' then
			return nil
		else
			return val
		end
	else
		return val
	end
end


local talmud = {}

talmud.jb_key = {b = "Babylonian", y = "Jerusalem"}

function talmud.generate_citation(frame)
	local args = getArgs(frame, { wrappers = 'Template:Cite Talmud', valueFunc = tidyVal })
	jb       = args[1] or 'b'
	if not talmud.jb_key[jb] then
		return require('Module:Error').error{ 'First argument must be either b for Babylonian Talmud or y for Jerusalem Talmud. (Given "' .. jb .. '")' }
	end
    tractate = args[2]
    daf      = args[4] or args[3] -- These are page or folio numbers as described at Talmud#Slavuta Talmud 1795 and Vilna Talmud 1835. Ranges are accepted, eg. 2b-4a
    url      = args.url
    nobook   = yesno(args[5] or args.nobook)
    if not url then
    	url = "https://www.sefaria.org/"
    	if(jb == 'y') then url = url .. 'Jerusalem_Talmud_' end 
    	url = url .. string.gsub(tractate, ' ', '_') .. '.' .. string.gsub(daf or '2a', ' ', '_')
    end
	str  = '[' .. url .. ' ' .. tractate .. ' ' .. ( daf or '' ) .. ']'
 	if not nobook then
		str = '[[Talmud]], <abbr title="' .. talmud.jb_key[jb] .. '">' .. jb .. '.</abbr> ' .. str
	end
	return str
end

return talmud

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.