<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.thegoonshow.co.uk/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3ABibleverse</id>
	<title>Module:Bibleverse - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.thegoonshow.co.uk/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3ABibleverse"/>
	<link rel="alternate" type="text/html" href="https://www.thegoonshow.co.uk/wiki/index.php?title=Module:Bibleverse&amp;action=history"/>
	<updated>2026-04-24T02:02:13Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.38.2</generator>
	<entry>
		<id>https://www.thegoonshow.co.uk/wiki/index.php?title=Module:Bibleverse&amp;diff=3034&amp;oldid=prev</id>
		<title>Kurt: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://www.thegoonshow.co.uk/wiki/index.php?title=Module:Bibleverse&amp;diff=3034&amp;oldid=prev"/>
		<updated>2022-07-21T14:14:48Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 09:14, 21 July 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Kurt</name></author>
	</entry>
	<entry>
		<id>https://www.thegoonshow.co.uk/wiki/index.php?title=Module:Bibleverse&amp;diff=3033&amp;oldid=prev</id>
		<title>en&gt;Johnuniq: for HE, remove &quot;www.&quot; from mechon-mamre.org URL because it is causing &quot;security risk&quot; warnings in browsers as their SSL certificate does not include wwww; per Anastrophe at template talk</title>
		<link rel="alternate" type="text/html" href="https://www.thegoonshow.co.uk/wiki/index.php?title=Module:Bibleverse&amp;diff=3033&amp;oldid=prev"/>
		<updated>2022-01-03T23:59:53Z</updated>

		<summary type="html">&lt;p&gt;for HE, remove &amp;quot;www.&amp;quot; from mechon-mamre.org URL because it is causing &amp;quot;security risk&amp;quot; warnings in browsers as their SSL certificate does not include wwww; per Anastrophe at template talk&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module implements Template:Bibleverse.&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
--codes from bvf that may be in use&lt;br /&gt;
local version_num_codes = {&lt;br /&gt;
	[9] = 'kjv', [31] = 'niv', [45] = 'amp', [49] = 'nasb', [64] = 'nivuk',&lt;br /&gt;
	[51] = 'nlt', [65] = 'msg', [76] = 'nirv', [105] = 'he', [104] = 'jps',&lt;br /&gt;
	[120] = 'opb', [121] = 'bb', [122] = 'bbc', [123] = 'bbl', [131] = 'nrsv',&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
--possible book inputs, based on Chicago Manual&lt;br /&gt;
local book_aliases = {&lt;br /&gt;
	['genesis'] = {'gen', 'gn'},                          --old testament/tanakh&lt;br /&gt;
	['exodus'] = {'exod', 'ex'},&lt;br /&gt;
	['leviticus'] = {'lev', 'lv'},&lt;br /&gt;
	['numbers'] = {'num', 'nm'},&lt;br /&gt;
	['deuteronomy'] = {'deut', 'dt'},&lt;br /&gt;
	['joshua'] = {'josh' , 'jo'},&lt;br /&gt;
	['judges'] = {'judg', 'jgs'},&lt;br /&gt;
	['ruth'] = {'ru'},&lt;br /&gt;
	['1_samuel'] = {'1sam', '1sm'},&lt;br /&gt;
	['2_samuel'] = {'2sam', '2sm'},&lt;br /&gt;
	['1_kings'] = {'1kgs'},&lt;br /&gt;
	['2_kings'] = {'2kgs'},&lt;br /&gt;
	['1_chronicles'] = {'1chron', '1chr'},&lt;br /&gt;
	['2_chronicles'] = {'2chron', '2chr'},&lt;br /&gt;
	['ezra'] = {'ezr'},&lt;br /&gt;
	['nehemiah'] = {'neh'},&lt;br /&gt;
	['esther'] = {'est'},&lt;br /&gt;
	['job'] = {'jb'},&lt;br /&gt;
	['psalms'] = {'ps', 'pss', 'psalm'},&lt;br /&gt;
	['proverbs'] = {'prov', 'prv'},&lt;br /&gt;
	['ecclesiastes'] = {'eccles', 'eccl', 'qoheleth'},&lt;br /&gt;
	['song_of_solomon'] = {'songofsol', 'songofsongs', 'song', 'sg', 'canticles', 'canticleofcanticles'},&lt;br /&gt;
	['isaiah'] = {'isa', 'is'},&lt;br /&gt;
	['jeremiah'] = {'jer'},&lt;br /&gt;
	['lamentations'] = {'lam'},&lt;br /&gt;
	['ezekiel'] = {'ezek', 'ez'},&lt;br /&gt;
	['daniel'] = {'dan', 'dn'},&lt;br /&gt;
	['hosea'] = {'hos'},&lt;br /&gt;
	['joel'] = {'jl'},&lt;br /&gt;
	['amos'] = {'am'},&lt;br /&gt;
	['obadiah'] = {'obad', 'ob'},&lt;br /&gt;
	['jonah'] = {'jon'},&lt;br /&gt;
	['micah'] = {'mic', 'mi'},&lt;br /&gt;
	['nahum'] = {'nah', 'na'},&lt;br /&gt;
	['habakkuk'] = {'hab', 'hb'},&lt;br /&gt;
	['zephaniah'] = {'zeph', 'zep'},&lt;br /&gt;
	['haggai'] = {'hag', 'hg'},&lt;br /&gt;
	['zechariah'] = {'zech', 'zec'},&lt;br /&gt;
	['malachi'] = {'mal'},&lt;br /&gt;
	['baruch'] = {'bar'},                                 --apocrypha/deuterocanon&lt;br /&gt;
	['ecclesiasticus'] = {'ecclus', 'wisdomofsirach', 'sirach', 'sir'},&lt;br /&gt;
	['1_esdras'] = {'1esd'},&lt;br /&gt;
	['2_esdras'] = {'2esd'},&lt;br /&gt;
	['judith'] = {'jth', 'jdt'},&lt;br /&gt;
	['1_maccabees'] = {'1macc', '1mc'},&lt;br /&gt;
	['2_maccabees'] = {'2macc', '2mc'},&lt;br /&gt;
	['3_maccabees'] = {'3macc', '3mc'},&lt;br /&gt;
	['4_maccabees'] = {'4macc', '4mc'},&lt;br /&gt;
	['prayer_of_manasseh'] = {'profman', 'prayerofmanasses'},&lt;br /&gt;
	['susanna'] = {'sus'},&lt;br /&gt;
	['tobit'] = {'tob', 'tb'},&lt;br /&gt;
	['wisdom_of_solomon'] = {'ws', 'wisdom', 'wisofsol'},&lt;br /&gt;
	['prayer_of_azariah'] = {'prayerofazariahandhymnofthethreechildren'},&lt;br /&gt;
	['rest_of_esther'] = {'additionstoesther'},&lt;br /&gt;
	['bel_and_the_dragon'] = {'bel'},&lt;br /&gt;
	['epistle_of_jeremiah'] = {'letterofjeremiah'},&lt;br /&gt;
	['matthew'] = {'matt', 'mt'},                         --new testament&lt;br /&gt;
	['mark'] = {'mk'},&lt;br /&gt;
	['luke'] = {'lk'},&lt;br /&gt;
	['john'] = {'jn'},&lt;br /&gt;
	['acts'] = {'actsoftheapostles'},&lt;br /&gt;
	['romans'] = {'rom'},&lt;br /&gt;
	['1_corinthians'] = {'1cor'},&lt;br /&gt;
	['2_corinthians'] = {'2cor'},&lt;br /&gt;
	['galatians'] = {'gal'},&lt;br /&gt;
	['ephesians'] = {'eph'},&lt;br /&gt;
	['philippians'] = {'phil'},&lt;br /&gt;
	['colossians'] = {'col'},&lt;br /&gt;
	['1_thessalonians'] = {'1thess', '1thes'},&lt;br /&gt;
	['2_thessalonians'] = {'2thess', '2thes'},&lt;br /&gt;
	['1_timothy'] = {'1tim', '1tm'},&lt;br /&gt;
	['2_timothy'] = {'2tim', '2tm'},&lt;br /&gt;
	['titus'] = {'ti'},&lt;br /&gt;
	['philemon'] = {'philem', 'phlm'},&lt;br /&gt;
	['hebrews'] = {'heb'},&lt;br /&gt;
	['james'] = {'jas'},&lt;br /&gt;
	['1_peter'] = {'1pet', '1pt'},&lt;br /&gt;
	['2_peter'] = {'2pet', '2pt'},&lt;br /&gt;
	['1_john'] = {'1jn'},&lt;br /&gt;
	['2_john'] = {'2jn'},&lt;br /&gt;
	['3_john'] = {'3jn'},&lt;br /&gt;
	['jude'] = {'jude'},&lt;br /&gt;
	['revelation'] = {'rev', 'apocalypse', 'apoc', 'rv'},&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local apoc = {&lt;br /&gt;
	['1_esdras'] = true, ['2_esdras'] = true, ['judith'] = true, ['1_maccabees'] = true,&lt;br /&gt;
	['2_maccabees'] = true, ['3_maccabees'] = true, ['4_maccabees'] = true,&lt;br /&gt;
	['prayer_of_manasseh'] = true, ['susanna'] = true, ['tobit'] = true,&lt;br /&gt;
	['wisdom_of_solomon'] = true, ['prayer_of_azariah'] = true, ['rest_of_esther'] = true,&lt;br /&gt;
	['bel_and_the_dragon'] = true, ['epistle_of_jeremiah'] = true,&lt;br /&gt;
	['sirach'] = true, ['ecclesiasticus'] = true,&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, ['epistle_of_jeremiah'] = true, ['prayer_of_azariah'] = true,&lt;br /&gt;
	['susanna'] = true, ['bel_and_the_dragon'] = true, ['prayer_of_manasseh'] = true,&lt;br /&gt;
	['philemon'] = true, ['2_john'] = true, ['3_john'] = true, ['jude'] = true,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
--sets the website to be used for each version, biblegateway is the fallback so don't define any for it&lt;br /&gt;
local site_tbl = {&lt;br /&gt;
	nrsv = 'oremus', nrsvae = 'oremus',&lt;br /&gt;
	kjv = 'wikisource', asv = 'wikisource',&lt;br /&gt;
	he = 'mechon_mamre', jps = 'mechon_mamre',&lt;br /&gt;
	niv = 'biblica', nivuk = 'biblica', amp = 'biblica', ab = 'biblica',&lt;br /&gt;
	nasb = 'biblica', msg = 'biblica', nlt = 'biblica', nirv = 'biblica',&lt;br /&gt;
	nab = 'usccb',&lt;br /&gt;
	bb = 'bible_hub', bbc = 'bible_hub', bbl = 'bible_hub', opb = 'bible_hub',&lt;br /&gt;
	esv = 'esv_bible',&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
--pattern for the url of each site using _book etc. (underscore then letters [a-z]) for variables&lt;br /&gt;
local urlpat_tbl = {&lt;br /&gt;
	oremus = 'https://bible.oremus.org/?passage=_book%20_vrange&amp;amp;version=_version',&lt;br /&gt;
	wikisource = 's:Bible (_version)/_book#_schap:_svers',&lt;br /&gt;
	mechon_mamre = 'https://mechon-mamre.org/_version_book_schap.htm#_svers',&lt;br /&gt;
	biblica = 'https://www.biblica.com/bible/?osis=_version:_book%20_vrange',&lt;br /&gt;
	usccb = 'https://bible.usccb.org/bible/_book/_schap?_svers',&lt;br /&gt;
	biblegateway = 'https://www.biblegateway.com/passage/?search=_book+_vrange&amp;amp;version=_version',&lt;br /&gt;
	bible_hub = 'https://_version/_book/_schap-_svers.htm',&lt;br /&gt;
	esv_bible = 'https://www.esv.org/_book+_schap:_svers',&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
--changes book name to use in url for each site, only if necessary&lt;br /&gt;
local site_book_tbl = {&lt;br /&gt;
	oremus = {&lt;br /&gt;
		['epistle_of_jeremiah'] = 'letter of jeremiah',&lt;br /&gt;
	},&lt;br /&gt;
	usccb = {&lt;br /&gt;
		['song_of_solomon'] = 'song_of_songs',&lt;br /&gt;
		['wisdom_of_solomon'] = 'wisdom',&lt;br /&gt;
		['ecclesiasticus'] = 'sirach',&lt;br /&gt;
	},&lt;br /&gt;
	mechon_mamre = {&lt;br /&gt;
		['genesis'] = '01', ['exodus'] = '02', ['leviticus'] = '03',&lt;br /&gt;
		['numbers'] = '04', ['deuteronomy'] = '05', ['joshua'] = '06',&lt;br /&gt;
		['judges'] = '07', ['1_samuel'] = '08a', ['2_samuel'] = '08b',&lt;br /&gt;
		['1_kings'] = '09a', ['2_kings'] = '09b', ['isaiah'] = '10',&lt;br /&gt;
		['jeremiah'] = '11', ['ezekiel'] = '12', ['hosea'] = '13',&lt;br /&gt;
		['joel'] = '14', ['amos'] = '15', ['obadiah'] = '16', ['jonah'] = '17',&lt;br /&gt;
		['micah'] = '18', ['nahum'] = '19', ['habakkuk'] = '20',&lt;br /&gt;
		['zephaniah'] = '21', ['haggai'] = '22', ['zechariah'] = '23',&lt;br /&gt;
		['malachi'] = '24', ['1_chronicles'] = '25a', ['2_chronicles'] = '25b',&lt;br /&gt;
		['psalms'] = '26', ['job'] = '27', ['proverbs'] = '28', ['ruth'] = '29',&lt;br /&gt;
		['song_of_solomon'] = '30', ['ecclesiastes'] = '31', ['lamentations'] = '32',&lt;br /&gt;
		['esther'] = '33', ['daniel'] = '34', ['ezra'] = '35a', ['nehemiah'] = '35b',&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
--changes to the version name to be used in urls, only if necessary&lt;br /&gt;
local site_version_tbl = {&lt;br /&gt;
	mechon_mamre = {&lt;br /&gt;
		he = 'p/pt/pt',&lt;br /&gt;
		jps = 'e/et/et',&lt;br /&gt;
	},&lt;br /&gt;
	wikisource = {&lt;br /&gt;
		kjv = 'King James', ['9'] = 'King James',&lt;br /&gt;
		asv = 'American Standard',&lt;br /&gt;
	},&lt;br /&gt;
	bible_hub = {&lt;br /&gt;
		bb = 'biblebrowser.com',&lt;br /&gt;
		bbc = 'biblecommenter.com',&lt;br /&gt;
		bbl = 'scripturetext.com',&lt;br /&gt;
		opb = 'bible.cc',&lt;br /&gt;
	}&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;
local function titlecase(arg)&lt;br /&gt;
	-- http://grammar.yourdictionary.com/capitalization/rules-for-capitalization-in-titles.html&lt;br /&gt;
	-- recommended by The U.S. Government Printing Office Style Manual:&lt;br /&gt;
	-- 'Capitalize all words in titles of publications and documents,&lt;br /&gt;
	-- except a, an, the, at, by, for, in, of, on, to, up, and, as, but, or, and nor.'&lt;br /&gt;
	local alwayslower = {&lt;br /&gt;
		['a'] = true, ['an'] = true, ['the'] = true,&lt;br /&gt;
		['and'] = true, ['but'] = true, ['or'] = true, ['for'] = true,&lt;br /&gt;
		['nor'] = true, ['on'] = true, ['in'] = true, ['at'] = true, ['to'] = true,&lt;br /&gt;
		['from'] = true, ['by'] = true, ['of'] = true, ['up'] = true,&lt;br /&gt;
	}&lt;br /&gt;
	local words = mw.text.split(mw.text.trim(arg or ''), '_')&lt;br /&gt;
	for i, s in ipairs(words) do&lt;br /&gt;
		s = string.lower(s)&lt;br /&gt;
		if i &amp;gt; 1 then&lt;br /&gt;
			if not alwayslower[s] then&lt;br /&gt;
				s = mw.getContentLanguage():ucfirst(s)&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			s = mw.getContentLanguage():ucfirst(s)&lt;br /&gt;
		end&lt;br /&gt;
		words[i] = s&lt;br /&gt;
	end&lt;br /&gt;
	return table.concat(words, '_')&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 default_version = 'nrsv'&lt;br /&gt;
	local input_book = ''&lt;br /&gt;
	local ref = ''&lt;br /&gt;
	local version = ''&lt;br /&gt;
	local version_num&lt;br /&gt;
	local text = ''&lt;br /&gt;
	local mainspace = mw.title.getCurrentTitle():inNamespaces(0)&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;
		version = mw.ustring.lower(args[4] or default_version)&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;
		version = mw.ustring.lower(args[3] or default_version)&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;
	text = text:gsub('-', '–')  --change hyphens to en dashes (3:2-5 → 3:2–5)&lt;br /&gt;
&lt;br /&gt;
	if tonumber(version) then&lt;br /&gt;
		version = version_num_codes[tonumber(version)] or version&lt;br /&gt;
		version_num = true&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local errors = {}&lt;br /&gt;
	if version == 'jpr' or version == 'jp' then  --chabad doesn't work so reroute&lt;br /&gt;
		version = 'he'&lt;br /&gt;
		if mainspace then&lt;br /&gt;
			table.insert(errors, '[[Category:Pages with Bible version errors]]')&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local book = input_book:gsub('%p', ''):gsub(' ', '_')&lt;br /&gt;
	book = mw.ustring.lower(book)&lt;br /&gt;
&lt;br /&gt;
	local book_found = false&lt;br /&gt;
	local standard = book:gsub('_', '')&lt;br /&gt;
	for full_book, aliases in pairs(book_aliases) do&lt;br /&gt;
		if standard == full_book:gsub('_', '') or valueExists(aliases, standard) then&lt;br /&gt;
			book = full_book&lt;br /&gt;
			book_found = true&lt;br /&gt;
			break&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local site = site_tbl[version] or 'biblegateway'    --fall back on biblegateway for unrecognized version because it has so many versions&lt;br /&gt;
&lt;br /&gt;
	if apoc[book] and version == 'nrsv' and site == 'oremus' then  --oremus's nrsv doesn't have the apocrypha&lt;br /&gt;
		version = 'nrsvae'  --the anglicized version does&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local urlpat = urlpat_tbl[site]&lt;br /&gt;
&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;
&lt;br /&gt;
	local e_chap, e_vers, 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;
		e_chap = 1&lt;br /&gt;
		e_vers = e_ref[2] or e_ref[1] or 1&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;
		if e_ref[2] or not s_ref[2] then     --chapter-chapter or chapter(:verse)?-chapter:verse&lt;br /&gt;
			e_chap = e_ref[1] or s_chap&lt;br /&gt;
		else                                 --chapter:verse-verse&lt;br /&gt;
			e_chap = s_chap&lt;br /&gt;
		end&lt;br /&gt;
		e_vers = e_ref[2] or e_ref[1] or s_vers&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if type(site_book_tbl[site]) == 'table' then&lt;br /&gt;
		book = site_book_tbl[site][book] or book&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	book = titlecase(book)  --title case looks better at oremus where they display the input&lt;br /&gt;
&lt;br /&gt;
	if site == 'mechon_mamre' then    --special case handling for components of the url&lt;br /&gt;
		if not tonumber(s_chap) then  --non-numeric characters were omitted above so this may not be what was entered&lt;br /&gt;
			error('Bibleverse error: start chapter should be a number', 0)&lt;br /&gt;
		end&lt;br /&gt;
		s_chap = string.format('%x', s_chap/10) .. (s_chap % 10)&lt;br /&gt;
	elseif site == 'biblica' or site == 'oremus' then&lt;br /&gt;
		book = book:gsub('_', '%%20')&lt;br /&gt;
	elseif site == 'esv_bible' or site == 'biblegateway' then&lt;br /&gt;
		book = book:gsub('_', '+')&lt;br /&gt;
	elseif site == 'bible_hub' then&lt;br /&gt;
		book = string.lower(book)&lt;br /&gt;
	elseif site == 'usccb' then&lt;br /&gt;
		book = book:gsub('_', '')&lt;br /&gt;
	end&lt;br /&gt;
	if type(site_version_tbl[site]) == 'table' then&lt;br /&gt;
		version = site_version_tbl[site][version]&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local v_range&lt;br /&gt;
	if chapter_only then&lt;br /&gt;
		if e_chap == s_chap then&lt;br /&gt;
			v_range = s_chap&lt;br /&gt;
		else&lt;br /&gt;
			v_range = s_chap .. '–' .. e_chap&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		if e_chap == s_chap and e_vers == s_vers then&lt;br /&gt;
			v_range = s_chap ..':' .. s_vers&lt;br /&gt;
		elseif e_chap == s_chap then&lt;br /&gt;
			v_range = s_chap .. ':' .. s_vers .. '–' .. e_vers&lt;br /&gt;
		else&lt;br /&gt;
			v_range = s_chap .. ':' .. s_vers .. '–' .. e_chap .. ':' .. e_vers&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local url = urlpat:gsub('_%l+', {  --get the components into the url&lt;br /&gt;
					_book    = book,&lt;br /&gt;
					_schap   = s_chap,&lt;br /&gt;
					_svers   = s_vers,&lt;br /&gt;
					_echap   = e_chap,&lt;br /&gt;
					_evers   = e_vers,&lt;br /&gt;
					_vrange  = v_range,&lt;br /&gt;
					_version = version,&lt;br /&gt;
				})&lt;br /&gt;
&lt;br /&gt;
	local fulllink&lt;br /&gt;
	if site == 'wikisource' then  --interwikilink&lt;br /&gt;
		fulllink = '[[' .. url .. '|' .. text .. ']]'&lt;br /&gt;
	else&lt;br /&gt;
		fulllink = '[' .. url .. ' ' .. text .. ']'&lt;br /&gt;
	end&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>en&gt;Johnuniq</name></author>
	</entry>
</feed>