Module:BibleQuote: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
local p = {} --p stands for package | local p = {} --p stands for package | ||
local function verses( | local function verses(frame) | ||
local _, _, book, chapter, startVerse, stopVerse = | local _, _, book, chapter, startVerse, stopVerse = | ||
string.find( | string.find(frame.args[1], "%s-(.+)%s+(%d+):(%d+)-(%d+)") | ||
local verses = {} | local verses = {} | ||
if stopVerse == nil then | if stopVerse == nil then | ||
return frame:expandTemplate{title = | return frame:expandTemplate{title = frame.args[1]} | ||
end | end | ||
Line 24: | Line 24: | ||
function p.standard(frame) | function p.standard(frame) | ||
local result = verses(frame | local result = verses(frame) | ||
if not frame.args.showPilcrow then | if not frame.args.showPilcrow then |
Revision as of 16:08, 8 December 2023
Documentation for this module may be created at Module:BibleQuote/doc
local p = {} --p stands for package
local function verses(frame)
local _, _, book, chapter, startVerse, stopVerse =
string.find(frame.args[1], "%s-(.+)%s+(%d+):(%d+)-(%d+)")
local verses = {}
if stopVerse == nil then
return frame:expandTemplate{title = frame.args[1]}
end
for i = startVerse, stopVerse, 1 do
local verse = frame:expandTemplate{title = book.." "..chapter..":"..i}
table.insert(verses, verse)
end
return table.concat(verses, " ")
end
local function removePilcrow(verse)
return string.gsub(verse, "¶ ", "")
end
function p.standard(frame)
local result = verses(frame)
if not frame.args.showPilcrow then
return removePilcrow(result)
end
return result
end
return p