Module:ja-link/multi

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


local export = {}

local m_template_parser = require("Module:template parser")

local class_else_type = m_template_parser.class_else_type
local ja_link = require("Module:ja-link").link
local parse = m_template_parser.parse
local pcall = pcall
local process_params = require("Module:parameters").process

local alias_of_3 = {alias_of = 3}
local boolean = {type = "boolean"}
local params = {
	 = {required = true},
	 = true,
	 = true,
	 = alias_of_3,
	 = alias_of_3,
	 = {allow_empty = true},
	 = true,
	 = true,
	 = true,
	 = true,
	 = boolean,
	 = boolean,
	 = {type = "boolean", default = false},
}

local function process_template(args, lang)
	args = process_params(args, params)
	return ja_link({
		lang = lang,
		lemma = args,
		kana = args,
		gloss = args,
		lit = args,
		pos = args,
		id = args,
		linkto = args,
		tr = args,
	}, {
		caps = args,
		hist = args,
		disableSelfLink = args,
	})
end

function export.main(frame)
	local text = frame:getParent().args
	if not text then
		return ""
	end
	local lang = require("Module:languages").getByCode(frame.args or "ja")
	local Jpan_template = lang:getCode() .. "-r"
	
	text = parse(frame:getParent().args)
	for node, parent, key in text:__pairs("next_node") do
		local class = class_else_type(node)
		if class ~= "wikitext" then
			local new
			if class == "template" and node:get_name() == Jpan_template then
				local success, result = pcall(process_template, node:get_arguments(), lang)
				if success then
					new = result
				end
			end
			if not new then
				new = node:expand()
			end
			if parent then
				parent = new
			else
				text = new
			end
		end
	end
	return tostring(text)
end

return export