This module is a data module providing a catalogue of passages from one particular book or article for each passage to demonstrate the existence of multiple Northern Thai words. The modules returns a 3-D array (technically a Lua table), indexed as follows:

  1. The outer index is the page number.
  2. The second index is a character string serving as the name of the passage within the page - using the first word is the simplest scheme.
  3. The third index is an element number - the text (item 1), its transliteration (item 2) (optional) and its translation (item 3).

The table has one named element, "reference", that holds the name of the template (namely, {{RQ:nod:NT}}) used to identify the source to the reader and format the quote, its transliteration and its translation. The table structure allows fields lang, p1 and p2 for uninterpreted passage to the reference template to customise its output. This particular module's table uses p1 as the English name of the verse quoted. The field applied to the innermost of the passage, page and table is the value passed on.

The intention is that the word will be highlighted when selected by these three indices. Words are assigned positive numbers and their boundaries are marked up in the form {number-word}. This mark up can be nested, so that words may contain other words. Different sections may have the same number; this allows for repeated words, overlapping words, and discontiguous translations.

The words are transcluded into a page using an invocation of the form {{RQ:nod:NT quote|4|c1v21_T|15}}; this example produces the text:

2017, Wycliffe Bible Translators, พระคริสตธรรมคัมภีร์ [New Testament], →ISBN, Matthew i.21, page 4:
มารีย์จะเกิดลูกป้อจาย เมื่อเกิดมาแล้วหื้อตั้งจื้อว่า ‘เยซู’ ย้อนว่าต้านจะจ้วยคนของต้านหื้อรอดป๊นบาปโต้ษ
maa-rii cà kə̀ət lûuk pɔ̂ɔ-caai. mʉ̂ʉa kəət maa lɛ́ɛo, hʉ̂ʉ tâŋ cʉ̂ʉ wâa 'yeesuu' yɔ̂ɔn wâa tâan cà cûuai khon khɔ̂ɔŋ tâan hʉ̂ʉ rɔ̂ɔt pón bàap tôot
Mary shall give birth to a male child. Once he has been born, you shall give him 'Jesus' as his name for the reason that it is he who shall help his people to escape from their sins.

There is no advantage in including a passage for the sake of one word; one can use {{RQ:nod:NT}} directly for that purpose.

For Thai script passages, the 'transliteration' follows the Wiktionary rules for Siamese, except that the voicing onset times are represented as d ~ t ~ th rather than d ~ dt ~ t. Note that for voiceless stops, the Thai script does not distinguish the late falling glottalised tone from the falling tone.

Exceptionally, 4th element of passages with names ending _T may be the Lanna script form. It will then be converted to the Lanna script form of the passage with corresponding name ending in _L, and the 5th element if any will be its transliteration.


-- English translations from World English Bible https://ebible.org/eng-web/engweb_p_color6x9.pdf
-- with adaptions to match the Northern Thai better.

data = {lang = 'nod', reference='RQ:nod:NT'}
-- Exceptionally, 4th line of passages with names ending _T may be the Lanna script form.
-- It will then be converted to the Lanna script form of the passage with corresponding
-- name ending in _L, and the 5th line if any will be its transliteration.

data[4] = {
	c1v21_T = {
		p1 = "Matthew i.21",
-- Unusable for Word 25.
		"{1-มารีย์}<wbr>{2-จะ}<wbr>{26-{3-เกิด}}<wbr>{4-ลูก}<wbr>{5-ป้อจาย} "..
			"{6-เมื่อ}<wbr>{27-{3-เกิด}}<wbr>{7-มา}<wbr>{8-แล้ว}<wbr>{28-{9-หื้อ}}<wbr>{10-ตั้ง}"..
			"<wbr>{11-จื้อ}<wbr>{12-ว่า} ‘{13-เยซู}’ {15-{14-ย้อน}<wbr>{12-ว่า}}"..
			"<wbr>{16-ต้าน}<wbr>{2-จะ}<wbr>{20-จ้วย}<wbr>{18-คน}<wbr>{19-ของ}<wbr>"..
			"{16-ต้าน}<wbr>{21-{9-หื้อ}}<wbr>{22-รอด}<wbr>{23-ป๊น}<wbr>{24-บาป}<wbr>{25-โต้ษ}",
		"{1-maa-rii} {2-cà} {26-{3-kə̀ət}} {4-lûuk} {5-pɔ̂ɔ-caai}. "..
			"{6-mʉ̂ʉa} {27-{3-kəət}} {7-maa} {8-lɛ́ɛo}, {28-{9-hʉ̂ʉ}} {10-tâŋ} "..
			"{11-cʉ̂ʉ} {12-wâa} '{13-yeesuu}' {15-{14-yɔ̂ɔn} {12-wâa}} "..
			"{16-tâan} {2-cà} {20-cûuai} {18-khon} {19-khɔ̂ɔŋ} {16-tâan} "..
			"{21-{9-hʉ̂ʉ}} {22-rɔ̂ɔt} {23-pón} {24-bàap} {25-tôot}",
-- WEB:		"She shall give birth to a son. You shall name him Jesus for it is
--			 he who shall save his people from their sins.”, -- p589
		"{1-Mary} {2-shall} {26-{3-give birth to}} {4-a} {5-male} {4-child}. "..
			"{6-Once} he {7-has} {27-{3-been born}}, you {8-shall} {28-{9-give}} him "..
			"{12-'}{13-Jesus}{12-'} {10-as} "..
			"{11-his name} {15-{14-for the reason} "..
			"{12-that}} it is {16-he} who {2-shall} {20-help} {16-hi}{19-s} "..
			"{18-people} {21-{9-to}} {22-escape} {23-from} their {24-sins}{25-}.",
		"{1-ᨾᩣᩁᩦ᩠ᨿ᩺}<wbr>{2-ᨧᩢ᩠ᨠ}<wbr>{26-{3-ᨠᩮᩥ᩠ᨯ}}<wbr>{4-ᩃᩪᨠ}<wbr>{5-ᨻᩬᩴ᩵ᨩᩣ᩠ᨿ} "..
			"{6-ᨾᩮᩬᩥ᩵ᩋ}<wbr>{27-{3-ᨠᩮᩥ᩠ᨯ}}<wbr>{7-ᨾᩣ}<wbr>{8-ᩓ᩠ᩅ}<wbr>{28-{9-ᩉᩨ᩶}}<wbr>{10-ᨲᩢ᩠᩶ᨦ}"..
			"<wbr>{11-ᨩᩨ᩵}<wbr>{12-ᩅ᩵ᩤ} <{13-ᨿᩮᨪᩪ}> {15-{14-ᨿᩬ᩶ᩁ}<wbr>{12-ᩅ᩵ᩤ}}"..
			"<wbr>{16-ᨴ᩵ᩤ᩠ᨶ}<wbr>{2-ᨧᩢ᩠ᨠ}<wbr>{20-ᨩ᩠᩵ᩅ᩠ᨿ}<wbr>{18-ᨤᩫ᩠ᨶ}<wbr>{19-ᨡᩬᨦ}<wbr>{16-ᨴ᩵ᩤ᩠ᨶ}<wbr>"..
			"{21-{9-ᩉᩨ᩶}}<wbr>{22-ᩁᩬᨯ}<wbr>{23-ᨻᩫ᩠᩶ᨶ}<wbr>{24-ᨷᩤ᩠ᨸ}<wbr>{25-ᨴᩰᩫ᩠ᩇ}"
		}
}
data[6] = {
	c2v13a_T = {
		p1 = 'Matthew ii.13',
		"{1-เมื่อ}<wbr>{2-หมู่}<wbr>{3-โหราจ๋ารย์}<wbr>{4-ปิ๊ก}<wbr>{5-ไป}<wbr>{6-แล้ว} "..
		"{7-{8-ทูต}{9-สวรรค์}}<wbr>{10-ของ}<wbr>{11-พระเจ้า}<wbr>{61-{12-องค์}<wbr>{13-นึ่ง}}"..
		"<wbr>{14-มา}<wbr>{15-เข้า}<wbr>{16-ฝัน}<wbr>{17-โยเซฟ}<wbr>{18-บอก}<wbr>{19-{51-ว่า}} "..
		"“{60-{20-ลุก}<wbr>{21-ขึ้น}} {22-ปา}<wbr>{23-สอง}<wbr>{24-แม่}<wbr>{25-ลูก}<wbr>"..
		"{26-หนี}<wbr>{27-ไป}<wbr>{28-อยู่}<wbr>{62-{29-ตี้}}<wbr>{30-ประเทศ}<wbr>{31-อียิปต์} "..
		"{32-เถิง}<wbr>{6-แล้ว}<wbr>{34-หื้อ}<wbr>{28-อยู่}<wbr>{36-{63-{29-ตี้}}<wbr>{38-หั้น}} "..
		"{39-{40-จ๋น}<wbr>{41-กว่า}}<wbr>{42-เฮา}<wbr>{43-จะ}<wbr>{44-บอก}<wbr>"..
		"{34-หื้อ}<wbr>{46-ปิ๊ก}<wbr>{14-มา}<wbr>{47-แหม}<wbr>{48-ใหม่} {49-{50-ย้อน}<wbr>{51-ว่า}}<wbr>"..
		"{52-กษัตริย์}<wbr>{53-เฮโรด}<wbr>{54-ก่ำลัง}<wbr>{55-จะ}<wbr>{56-ส่ง}<wbr>{57-คน}<wbr>"..
		"{14-มา}<wbr>{58-ตวย}<wbr>{59-ฆ่า}<wbr>{25-ลูก}”",
-- 12, 13, 40, 41 seem unisolatable.  Alternative translation is to be used for
-- words 8, 9, 29, 38
		"{1-mʉ̂ʉa} {2-mùu} {3-hǒo-raa-cǎan} {4-pík} {5-pai} {6-lɛ́ɛo}, "..
		"{7-{8-thûut}-{9-sàwǎn}} {10-khɔ̌ɔŋ} {11-phrácâaw} {61-{12-oŋ} {13-nʉ̂ŋ}} "..
		"{14-maa} {15-khâo} {16-fǎn} {17-yoosèef} {18-bɔ̀ɔk} {19-{51-wâa}} "..
		"“{60-{20-lúk} {21-khʉ̂n}} {22-paa} {23-sɔ̌ɔŋ} {24-mɛ̂ɛ} {25-lûuk} "..
		"{26-nǐi} {27-pai} {28-yùu} {62-{29-tîi}} {30-pràthêet} {31-iiyíp} "..
		"{32-thəəŋ} {6-lɛ́ɛo} {34-hʉ̂ʉ} {28-yùu} {36-{63-{29-tîi}} {38-hân}} "..
		"{39-{40-cǒn} {41-kwàa}} {42-hao} {43-cà} {44-bɔ̀ɔk} "..
		"{34-hʉ̂ʉ} {46-pík} {14-maa} {47-hɛ̌ɛm} {48-mài}, {49-{50-yɔ́ɔn} {51-wâa}} "..
		"{52-kàsàt} {53-hee-rôot} {54-kàmlaŋ} {55-cà} {56-sòŋ} {57-khon} {14-maa} "..
		"{58-tuuai} {59-khâa} {25-lûuk}.",
		"{1-When} {2-the group} of {3-astrologers} {6-had} {4-evasively} {5-go}{6-ne}, "..
		"{61-an} {7-angel} {10-of} {11-the Lord} {14-appeared} {15-to} {17-Joseph} "..
		"{15-in} {16-a dream}, {18-saying}, {19-{51-“}}{60-{20-Get {21-up}}} and "..
		"{22-take} {23-both} {25-the young child} and {24-his mother}, "..
		"and {26-flee} and {27-go} and {28-stay} {62-in} {30-the land} of {31-Egypt}, "..
		"and {6-having} {32-reached it}, {34-do} {28-stay} {36-there} "..
		"{39-until} {42-we} {47-then} {44-tell} you {34-to} {14-come} {46-back} "..
		"{48-again}, {49-{50-for}} {52-King} {53-Herod} {55-will} "..
		"{54-be} {56-send}{54-ing} {57-men} {58-to} {59-kill} {25-the child}.{19-{51-”}}",
		"{1-ᨾᩮᩬᩥ᩵ᩋ}<wbr>{2-ᩉ᩠ᨾᩪ᩵}<wbr>{3-ᩉᩰᩁᩣᨧᩣᩁ᩠ᨿ᩺}<wbr>{4-ᨻᩥ᩠ᨠ}<wbr>{5-ᨻᩱ}<wbr>{6-ᩓ᩠ᩅ} "..
		"{7-{8-ᨴᩪᨲ}{9-ᩈ᩠ᩅ᩻ᩢᩁ᩠ᨣ᩺}}<wbr>{10-ᨡᩬᨦ}<wbr>{11-ᨻᩕᨧᩮᩢ᩶ᩣ}<wbr>{12-ᩋᩫᨦ᩠ᨣ᩺}<wbr>{13-ᨶᩧ᩠᩵ᨦ}<wbr>"..
		"{14-ᨾᩣ}<wbr>{15-ᨡᩮᩢ᩶ᩣ}<wbr>{16-ᨺᩢ᩠ᨶ}<wbr>{17-ᨿᩰᨪᩮ᩠ᨸ}<wbr>{18-ᨷᩬᨠ}<wbr>{19-{51-ᩅ᩵ᩤ}} "..
		"<<{60-{20-ᩃᩩᨠ}<wbr>{21-ᨡᩧ᩠᩶ᨶ}} {22-ᨻᩣ}<wbr>{23-ᩈᩬᨦ}<wbr>{24-ᨾᩯ᩵}<wbr>{25-ᩃᩪᨠ}<wbr>"..
		"{26-ᩉ᩠ᨶᩦ}<wbr>{27-ᨻᩱ}<wbr>{28-ᩀᩪ᩵}<wbr>{62-{29-ᨴᩦ᩵}}<wbr>{30-ᨷᩕᨴᩮ᩠ᩆ}<wbr>{31-ᩋᩦᨿᩥ᩠ᨸᨲ᩺} "..
		"{32-ᨳᩮᩥ᩠ᨦ}<wbr>{6-ᩓ᩠ᩅ}<wbr>{34-ᩉᩨ᩶}<wbr>{28-ᩀᩪ᩵}<wbr>{36-{63-{29-ᨴᩦ᩵}}<wbr>{38-ᩉᩢ᩠᩶ᨶ}} "..
		"{39-{40-ᨧᩫ᩠ᨶ}<wbr>{41-ᨠ᩠ᩅ᩵ᩣ}}<wbr>{42-ᩁᩮᩢᩣ}<wbr>{43-ᨧᩢ᩠ᨠ}<wbr>{44-ᨷᩬᨠ}<wbr>"..
		"{34-ᩉᩨ᩶}<wbr>{46-ᨻᩥ᩠ᨠ}<wbr>{14-ᨾᩣ}<wbr>{47-ᩉᩯ᩠ᨾ}<wbr>{48-ᩉ᩠ᨾᩲ᩵} {49-{50-ᨿᩬ᩶ᩁ}<wbr>{51-ᩅ᩵ᩤ}}<wbr>"..
		"{52-ᨠᩕᩈᩢ᩠ᨲ}<wbr>{53-ᩌᩮᩁᩰᩫ᩠ᨯ}<wbr>{54-ᨠ᩵ᩣᩴᩃᩢ᩠ᨦ}<wbr>{55-ᨧᩢ᩠ᨠ}<wbr>{56-ᩈᩫ᩠᩵ᨦ}<wbr>{57-ᨤᩫ᩠ᨶ}<wbr>ᨾᩣ<wbr>"..
		"{58-ᨴ᩠ᩅ᩠ᨿ}<wbr>{59-ᨡ᩶ᩣ}<wbr>{25-ᩃᩪᨠ}>>"
	}
}
data[6].c2v13b_T = mw.clone(data[6].c2v13a_T) 
data[6].c2v13b_T[3] =
-- Translation for Words 8, 9, 29, 38 and 63:
	"When the group of astrologers had evasively gone, an {8-envoy} from {9-heaven} "..
	"{10-of} {11-the Lord} appeared to Joseph in a dream, saying, "..
	"“Get up and take both the young child and his mother, and "..
	"flee and go and stay {62-{29-in}} the land of Egypt, and having reached it, "..
	"do {28-stay in} {38-that} {63-{29-place}} until we then tell you "..
	"to come back again, for King Herod will be sending men to kill the child.”"

local dbg = false
-- for pageno, page in ipairs(data) do -- ipairs() doesn't work!
local page
for pageno = 1, 904 do
	page = data[pageno]
	if dbg and page then mw.addWarning('Found page '..tostring(pageno)) end
	for psgname, psg in pairs(page or {}) do
		if type(psgname) ~= 'string' then
			if dbg then mw.addWarning('Page '..tostring(pageno)..'has strange element') end
		elseif not psgname:match('_T$') then
			if (dbg) then
				mmw.addWarning('Passage '..psgname..' on page '..tostring(pageno)..
					' ignored because of name.')
			end
		elseif page[psgname][4] then
			local psg_L = {}
			psg_L[1] = page[psgname][4]
			psg_L[2] = page[psgname][5] or ""
			psg_L[3] = page[psgname][3]
			psg_L.p1 = page[psgname].p1
			local newname = psgname:gsub('_T$', '_L')
			if dbg then
				mw.addWarning('Added passage '..newname..' to page '..tostring(pageno)..'.')
			end
			page[newname] = psg_L
			if dbg then
				mw.addWarning('Added passage '..newname..' to page '..tostring(pageno)..'.')
			end
		elseif dbg then
			mw.addWarning(	'No 4th string in '..psgname..
							' of page '..tostring(pageno)..'.')
		end
	end
end

return data