Content deleted Content added
m Updated bomBooks table to reflect new WS pages for the Title Page and the testimonies of the 3/8 witnesses |
Added logic to handle the common user error in which where the user forgets the second parameter and goes right into the chapter number without specifying the book parameter |
||
Line 293:
end
-- local function extractParams(args):
-- Extracts and returns the parameters from the table of args passed in
-- Includes logic to handle the case where a user forgets to pass in bookParam
local function extractParams(args)
local displayTextParam = trimSpaces(args[1])
Line 301 ⟶ 304:
-- the 6th and 7th parameters, for footnotes and cross-references, have no
-- use on Wikisource (and don't seem to work even on CoCJ.org, but whatever)
-- so they are ignored
local endVerseFlag = trimSpaces(args[8])
-- handle the common mistake where someone forgets the second parameter
-- altogether (e.g., {{LDS|Alma|7|11}}).
-- This is done by testing whether the second parameter, which should be the
-- name/abbrev. of the book (e.g., 1ne), is instead a number. In that case
-- we will try assuming that the params should just be "shifted" over 1
-- and use the display text as the bookParam and go from there, fingers crossed.
if tonumber(args[2]) then
-- the second parameter is a number (tonumber returns nil if there is any text in its argument)
bookParam = trimSpaces(args[1]) -- use the display text and hope it's the full name of the book (or a valid abbreviation)!
chapterParam = trimSpaces(args[2])
verseParam = trimSpaces(args[3])
endVerseParam = trimSpaces(args[4])
endVerseFlag = trimSpaces(args[7])
end
return displayTextParam, bookParam, chapterParam, verseParam, endVerseParam, endVerseFlag
end
|