Module:RQ:pi:Sai Kam Mong

Hello, you have come here looking for the meaning of the word Module:RQ:pi:Sai Kam Mong. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:RQ:pi:Sai Kam Mong, but we will also tell you about its etymology, its characteristics and you will know how to say Module:RQ:pi:Sai Kam Mong in singular and plural. Everything you need to know about the word Module:RQ:pi:Sai Kam Mong you have here. The definition of the word Module:RQ:pi:Sai Kam Mong will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:RQ:pi:Sai Kam Mong, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

Invoking this module as {{#invoke:RQ:pi:Sai Kam Mong|quote|a|b|c|passages=xxx}} is equivalent to invoking a template as {{{{yyy}} quote|a|b|c}}, for some yyy, so please read that template for usage. If the argument passages is omitted, the effect is equivalent to invoking the template as {{RQ:pi:Sai Kam Mong quote|a|b|c}}.

The templates and modules for the use of this come in sets of three - a citation selection template, a data module, and a display template.

The citation selection template simply invokes this module's function quote; module invocations are not allowed in the main space pages, but must be wrapped in a template. This function accesses and manipulates the data in the data module, while the display template can function independently of it and the the data.

Wiktionary requests that each template and module have a documentation page. For the first two, boilerplate templates {{RQ:pi:Sai Kam Mong/quote boilerplate|human-language-documented|data-module-name|sample-page-no|sample-passage-id|sample-word-number|passages=data-module-name}} and {{RQ:pi:Sai Kam Mong/passage boilerplate|human-language-documented|data-module-name|sample-page-no|sample-passage-id|sample-word-number}} provide most of this documentation. The boilerplate templates require that name of the citation slection template be the name of the data module augmented by the word 'quote'. The display template's documentation is less stereotyped, and adaptation of one set's to a new set's must be done manually. Adapting the example looks daunting, but is not as difficult as it looks. The trick is to start from the bottom and work up.

Existing sets include:

Citation selection template Data module Display template
{{RQ:pi:N3207 quote}} {{Module:RQ:pi:N3207}} {{RQ:pi:N3207}}
{{RQ:pi:Phaya Luang Maha Sena quote}} {{Module:RQ:pi:Phaya Luang Maha Sena}} {{RQ:pi:Phaya Luang Maha Sena}}
{{RQ:pi:Sai Kam Mong quote}} {{Module:RQ:pi:Sai Kam Mong/passages}} {{RQ:pi:Sai Kam Mong}}
{{RQ:pi:Thai chant book quote}} {{Module:RQ:pi:Thai chant book}} {{RQ:pi:Thai chant book}}
{{RQ:pi:U17106 quote}} {{Module:RQ:pi:U17106}} {{RQ:pi:U17106}}

If creating a new set, the 'Sai Kam Mong' set would be a bad set to start from, as for historical reasons, it has different and confusing naming conventions. Some of these issues are worked round by the defaults in the documentation templates.


local export = {};
local gsub = string.gsub  -- Can pretend it's all Latin-1!
local trim = mw.text.trim -- Except for trimmming strings.

function export.quote(frame)
	-- Convert from string if decimal, and trim if not.
	local fa1 = frame.args
	local pageno = tonumber(fa1) or fa1 and trim(fa1)
	if not pageno or pageno == "" then
		return "Invalid or missing page number"
	end
	local quotid = frame.args
	if quotid then
		quotid = trim(quotid)
		if string.len(quotid) == 0 then quotid = nil end
	end
	if not quotid then
		return "Passage ID is missing"
	end
	local wordid = tonumber(frame.args) or 0
	local passages = frame.args or 'RQ:pi:Sai Kam Mong/passages'
	passages = mw.loadData('Module:'..passages)
	local passage = passages
	if passage then
		passage=passage
		if passage then
            local highlight = function() end
			local function consider_word(m1)
				if string.find(m1, "^{"..wordid.."%-") then
					return "'''"..m1.."'''"
				else
					return "{"..highlight(string.sub(m1, 2))
				end
			end
			highlight = function(m2)
				return gsub(m2, "%b{}", consider_word)
			end
			local function process(line)
				if line then
					line = highlight(line)
					line = gsub(line, "{%d%d*-", "")
					line = gsub(line, "}", "")
					line = gsub(line, "''''''", "")
					line = gsub(line, '⧁', "<span style='background-color:#FFff00;'>")
					line = gsub(line, '⧀', "</span>")
				end
				return line
			end
			local text, tran, xlit, lit, norm, ts
			text = process(passage)
			tran = process(passage)
			xlit = process(passage)
			lit  = process(passage.lit)
			norm = process(passage.norm)
			ts   = process(passage.ts)
			local reference = frame.args.reference or passages.reference
			return frame:expandTemplate{title = trim(reference),
				args = { pageno, text, tran, xlit,
					lang = passage.lang or passages.lang or passages.lang,
					p1 = passage.p1 or passages.p1 or passages.p1,
					p2 = passage.p2 or passages.p2 or passages.p2,
					brackets = frame.args.brackets,
					norm = norm,
					lit  = lit,
					ts = ts
				} }
		else
			return "No passage dubbed \"" .. quotid .. "\" on page " .. pageno
		end
	else
		return "There are no passages from page " .. pageno
	end
end
return export