Jump to content

Module:Cite Talmud

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Daask (talk | contribs) at 22:01, 14 May 2019 (Fix string append for Lua). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

-- For unit tests, see [[Module:Bananas/testcases]]
local talmud = {}

function talmud.generate_citation(frame) -- This section is the core of the module. 'Name2' is a name of your choice. The same name needs to be referred to when the module is used.
	-- The next five lines are mostly for convenience only and can be used as is for your module. The output conditions start on line 20.
	local pf = frame:getParent().args -- This line allows template parameters to be used in this code easily. The equal sign is used to define variables. 'pf' can be replaced with a word of your choice.
	-- local f = frame.args -- This line allows parameters from {{#invoke:}} to be used easily. 'f' can be replaced with a word of your choice.
	jb       = pf[1] or 'b' -- b for Babylonian Talmud or y for Jerusalem Talmud. Babylonian is default.
    tractate = pf[2]
    chapter  = pf[3] -- Chapter name or number (optional)
    daf      = pf[4] -- These are page or folio numbers as described at Talmud#Slavuta Talmud 1795 and Vilna Talmud 1835. Ranges are accepted, eg. 2b-4a
	str = "Talmud, " .. jb .. ". " .. tractate .. " " .. daf
	return str
end

return talmud