<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AAlhatorah</id>
	<title>Module:Alhatorah - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AAlhatorah"/>
	<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:Alhatorah&amp;action=history"/>
	<updated>2026-07-27T08:08:44Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.3</generator>
	<entry>
		<id>https://mywikibiz.com/index.php?title=Module:Alhatorah&amp;diff=470955&amp;oldid=prev</id>
		<title>Zoran: Moved page from wikipedia:en:Module:Alhatorah</title>
		<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:Alhatorah&amp;diff=470955&amp;oldid=prev"/>
		<updated>2021-07-08T19:16:34Z</updated>

		<summary type="html">&lt;p&gt;Moved page from &lt;a href=&quot;/index.php?title=Wikipedia:en:Module:Alhatorah&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Wikipedia:en:Module:Alhatorah (page does not exist)&quot;&gt;wikipedia:en:Module:Alhatorah&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module implements Template:Alhatorah. Based on Template:Bibleverse&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
--possible book inputs, based on Chicago Manual&lt;br /&gt;
local book_aliases = {&lt;br /&gt;
	['Bereshit'] = {'breishit', 'genesis', 'gen', 'gn'},&lt;br /&gt;
	['Shemot'] = {'exodus', 'exod', 'ex'},&lt;br /&gt;
	['Vayikra'] = {'leviticus', 'lev', 'lv'},&lt;br /&gt;
	['Bemidbar'] = {'bamidbar', 'numbers', 'num', 'nm'},&lt;br /&gt;
	['Devarim'] = {'deuteronomy', 'deut', 'dt'},&lt;br /&gt;
	['Yehoshua'] = {'joshua', 'josh' , 'jo'},&lt;br /&gt;
	['Shofetim'] = {'shoftim', 'judges', 'judg', 'jgs'},&lt;br /&gt;
	['Shemuel I'] = {'shmuel1', 'shmueli', '1shmuel', 'ishmuel', '1sam', '1sm'},&lt;br /&gt;
	['Shemuel II'] = {'shmuel2', 'shmuelii','2shmuel', 'iishmuel', '2sam', '2sm'},&lt;br /&gt;
	['Melakhim I'] = {'melachim1', 'melachimi', '1kings', 'ikings', '1kgs'},&lt;br /&gt;
	['Melakhim II'] = {'melachim2', 'melachimii', '2kings', 'iikings', '2kgs'},&lt;br /&gt;
	['Yeshayahu'] = {'isaiah', 'isa', 'is'},&lt;br /&gt;
	['Yirmeyahu'] = {'yirmiyahu', 'jeremiah', 'jer'},&lt;br /&gt;
	['Yechezkel'] = {'ezekiel', 'ezek', 'ez'},&lt;br /&gt;
	['Hoshea'] = {'hosea', 'hos'},&lt;br /&gt;
	['Yoel'] = {'joel', 'jl'},&lt;br /&gt;
	['Amos'] = {'amos', 'am'},&lt;br /&gt;
	['Ovadyah'] = {'ovadiah', 'obadiah', 'obad', 'ob'},&lt;br /&gt;
	['Yonah'] = {'jonah', 'jon'},&lt;br /&gt;
	['Mikhah'] = {'michah', 'micah', 'mic', 'mi'},&lt;br /&gt;
	['Nachum'] = {'nahum', 'nah', 'na'},&lt;br /&gt;
	['Chavakkuk'] = {'habakkuk', 'hab', 'hb'},&lt;br /&gt;
	['Zephanyah'] = {'tzefaniah', 'zephaniah', 'zeph', 'zep'},&lt;br /&gt;
	['Chaggai'] = {'haggai', 'hag', 'hg'},&lt;br /&gt;
	['Zekharyah'] = {'zechariah', 'zech', 'zec'},&lt;br /&gt;
	['Malakhi'] = {'malachi', 'mal'},&lt;br /&gt;
	['Tehillim'] = {'psalms', 'ps', 'pss', 'psalm'},&lt;br /&gt;
	['Mishlei'] = {'proverbs', 'prov', 'prv'},&lt;br /&gt;
	['Kohelet'] = {'ecclesiastes', 'eccles', 'eccl', 'qoheleth'},&lt;br /&gt;
	['Shir HaShirim'] = {'songofsolomon', 'songofsol', 'songofsongs', 'song', 'sg', 'canticles', 'canticleofcanticles'},&lt;br /&gt;
	['Eikhah'] = {'lamentations', 'lam'},&lt;br /&gt;
	['Rut'] = {'ruth', 'ru'},&lt;br /&gt;
	['Esther'] = {'esther', 'est'},&lt;br /&gt;
	['Iyyov'] = {'job', 'jb'},&lt;br /&gt;
	['Daniel'] = {'daniel', 'dan', 'dn'},&lt;br /&gt;
	['Divrei HaYamim I'] = {'divreihayamim1', 'ichronicles', '1chronicles', '1chron', '1chr'},&lt;br /&gt;
	['Divrei HaYamim II'] = {'divreihayamim2', 'iichronicles', '2chronicles', '2chron', '2chr'},&lt;br /&gt;
	['Ezra'] = {'ezra', 'ezr'},&lt;br /&gt;
	['Nechemyah'] = {'nechemiah', 'nehemiah', 'neh'},&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
--these books only have one chapter, have to be handled differently&lt;br /&gt;
local no_chapters = {&lt;br /&gt;
	['obadiah'] = true,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local function trimArg(text)&lt;br /&gt;
	if type(text) == 'string' then&lt;br /&gt;
		text = text:match('(%S.-)%s*$')  --trimmed text or nil if empty&lt;br /&gt;
	end&lt;br /&gt;
	return text&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function valueExists(tbl, value)&lt;br /&gt;
	for _, v in pairs(tbl) do&lt;br /&gt;
		if value == v then&lt;br /&gt;
			return true&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return false&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	local targs = frame:getParent().args&lt;br /&gt;
	local args = {}&lt;br /&gt;
	for _, param in ipairs({1, 2, 3, 4, 5, 'nobook'}) do&lt;br /&gt;
		args[param] = trimArg(targs[param])&lt;br /&gt;
	end&lt;br /&gt;
	local input_book = ''&lt;br /&gt;
	local ref = ''&lt;br /&gt;
	local commentary = ''&lt;br /&gt;
	local text = ''&lt;br /&gt;
	local mainspace = mw.title.getCurrentTitle():inNamespaces(0)&lt;br /&gt;
	&lt;br /&gt;
	--analyze arguments&lt;br /&gt;
	if args[1] == nil or args[2] == nil or tonumber(args[1]) ~= nil then&lt;br /&gt;
		-- first argument is a numeric prefix and second is book name&lt;br /&gt;
		input_book = trimArg((args[1] or '') .. ' ' .. (args[2] or '')) or ''&lt;br /&gt;
		ref = args[3] or ''&lt;br /&gt;
		commentary = args[4] or ''&lt;br /&gt;
		text = args[5] or trimArg((input_book .. ' ' .. ref))&lt;br /&gt;
	else&lt;br /&gt;
		-- first argument is the whole book name&lt;br /&gt;
		input_book = args[1] or ''&lt;br /&gt;
		ref = args[2] or ''&lt;br /&gt;
		commentary = args[3] or ''&lt;br /&gt;
		text = args[4] or (input_book .. ' ' .. ref)&lt;br /&gt;
	end&lt;br /&gt;
	if args.nobook == 'yes' then&lt;br /&gt;
		text = ref&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	--analyze book (for URL)&lt;br /&gt;
	local book = input_book:gsub('%p', ''):gsub(' ', '_')&lt;br /&gt;
	book_lower = mw.ustring.lower(book)&lt;br /&gt;
	book_lower = book_lower:gsub('_', '')&lt;br /&gt;
	local book_found = false&lt;br /&gt;
	for full_book, aliases in pairs(book_aliases) do&lt;br /&gt;
		if book_lower == mw.ustring.lower(full_book:gsub(' ', '_')) or valueExists(aliases, book_lower) then&lt;br /&gt;
			book = full_book:gsub(' ', '_')&lt;br /&gt;
			book_found = true&lt;br /&gt;
			break&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	--analyze verse&lt;br /&gt;
	local split_ref = mw.text.split(ref, '[-–—]')       --split the ref into the part before and after the dash/hyphen&lt;br /&gt;
	local s_ref = mw.text.split(split_ref[1], '%p')     --any punctuation can be used to separate chapter from verse&lt;br /&gt;
	local e_ref = split_ref[2] or split_ref[1]&lt;br /&gt;
	e_ref = mw.text.split(e_ref, '%p')&lt;br /&gt;
	for i, v in ipairs(s_ref) do s_ref[i] = v:gsub('%D', '') end  --remove any non-numeric character (such as f)&lt;br /&gt;
	for i, v in ipairs(e_ref) do e_ref[i] = v:gsub('%D', '') end&lt;br /&gt;
	local s_chap, s_vers&lt;br /&gt;
	local chapter_only = not s_ref[2]&lt;br /&gt;
	if no_chapters[book] then&lt;br /&gt;
		chapter_only = false&lt;br /&gt;
		s_chap = 1&lt;br /&gt;
		s_vers = s_ref[2] or s_ref[1] or 1   --verse 3 can be specified as &amp;quot;3&amp;quot; or &amp;quot;1:3&amp;quot;&lt;br /&gt;
	else&lt;br /&gt;
		s_chap = s_ref[1] or 1&lt;br /&gt;
		s_vers = s_ref[2] or 1&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	--build URL&lt;br /&gt;
	commentary = commentary:gsub(' ', '_') --must be outside URL command&lt;br /&gt;
	local urlpat = 'https://mg.alhatorah.org/Dual/_commentary/_book/_schap._svers#m7e3n7'&lt;br /&gt;
	local url = urlpat:gsub('_%l+', {  --get the components into the url&lt;br /&gt;
					_commentary = commentary,&lt;br /&gt;
					_book    = book,&lt;br /&gt;
					_schap   = s_chap,&lt;br /&gt;
					_svers   = s_vers,&lt;br /&gt;
				})&lt;br /&gt;
&lt;br /&gt;
	--build text&lt;br /&gt;
	text = text:gsub('-', '–')  --change hyphens to en dashes (3:2-5 → 3:2–5)&lt;br /&gt;
	text = commentary:gsub('_', ' ') .. ', ' .. text&lt;br /&gt;
	&lt;br /&gt;
	local fulllink&lt;br /&gt;
	fulllink = '[' .. url .. ' ' .. text .. ']'&lt;br /&gt;
&lt;br /&gt;
	if mainspace then&lt;br /&gt;
		if not book_found then&lt;br /&gt;
			table.insert(errors, '&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Template:Bibleverse with invalid book&amp;lt;/span&amp;gt;[[Category:Pages with Bible book errors]]')&lt;br /&gt;
		end&lt;br /&gt;
		if version_num then&lt;br /&gt;
			table.insert(errors, '[[Category:Pages with numeric Bible version references]]')&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return fulllink --.. table.concat(errors)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Zoran</name></author>
	</entry>
</feed>