Module:Repeated bible text

local z = {} local chapterNum, verseNum, text,frame;

function init(localFrame,chapter, verse) frame= localFrame; chapterNum = chapter; verseNum = verse; text = ""; end

function addVerse(verseText) text = text .. frame:expandTemplate{ title = "verse", args = {chapter=chapterNum,verse = verseNum}}; text= text .. verseText .. " ";	verseNum = verseNum + 1; end

function addComment(comment) return frame:preprocess{text=" "}; end

function commentHook(hook, comment) return hook .. addComment ("(" .. chapterNum .. ":" ..	   verse .. ") " .. hook .. " " .. comment); end

-- This produces both Psalm 18 and 2 Samuel 22. Note that -- the standard in Psalms is that a verse which is completely -- introductory is verse 0, not verse 1. function z.psalm18(frame) book = frame.args[1] if book == "Psalms" then init(frame,18,0); else init(frame,22,1); end verse = "" -- Psalms 18:0; 2 Samuel 22:1 if book == "Psalms" then verse = "For the conductor, for he who works Yahweh, for David: who spoke to Yahweh, these words of song,"; else verse = "And David spoke to Yahweh the words of this song"; end verse = verse .. " on the day that Yahweh delivered him from the hand of all his enemies, and from the hand of the underworld."; comment = "The Masoretic text says \"from the hand of Saul\", which is identical in the consinantal text."; if book == "Psalms" then comment = "Verse 0 to number the psalm from 1. "..comment; end verse = verse .. addComment(comment); addVerse(verse); -- Psalm 18 includes an extra verse; subsequently, -- the contents of the next 2 verses from 2 Samuel are shortened -- and placed in a single verse. verse = "Yahweh is my rock and my stronghold, and my rescuer.";

if book=="Psalms" then addVerse("And he said: I devote myself to you, Yahweh, my strength.") verse = verse .. " ";   else addVerse("And he said, " .. verse); verse=""; end verse = verse .. "The god of my rock, in him I take refuge, my shield" if not (book=="Psalms") then verse = verse .. ", and my horn of victory, my mountain fastness, my hiding place, my rescuer. You save me from oppression"; end addVerse(verse .. "."); -- Psalms 18:3 = 2 Samuel 22:4 addVerse("I will call upon Yahweh, worthy of praise, and I will be saved from my enemies."); -- 2 Samuel 22:5, Psalms 18: -- Samual has the word "when" present in the verse, Psalms doesn't  when = "When"; if book == "Psalms" then when = "[When]"; end addVerse(when .. " crashing waves of death would encompass me, torrents of vileness terrify me,"); -- 2 Samuel 22:6=Psalms 18:5 addVerse("death-pangs surround me, death-snares precede me,"); -- 2 Samuel 22:7,Psalms 18:6 verse = "in my distress I would call to Yahweh, and "; if book == "Psalms" then verse = verse .. "petition"; else verse = verse .. "call"; end verse = verse .. " to my god, and he heard my voice from his temple, "; if book == "Psalms" then verse = verse .. "and my petition to him will come before him, into his ears."; else verse = verse .. "my cry in his ears."; end addVerse(verse);

return text; end return z;