Difference between revisions of "Module:Cite Talmud"

From blackwiki
Jump to navigation Jump to search
test>Daask
(Begin porting Template:Cite Talmud)
 
test>Daask
(Fix string append for Lua)
Line 10: Line 10:
 
     chapter  = pf[3] -- Chapter name or number (optional)
 
     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
 
     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
+
str = "Talmud, " .. jb .. ". " .. tractate .. " " .. daf
 
return str
 
return str
 
end
 
end
  
 
return talmud
 
return talmud

Revision as of 22:01, 14 May 2019

Implements {{Cite Talmud}}


-- 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