Module:ja-link

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

local m_links = require("Module:links")
local m_string_utils = require("Module:string utilities")

local ugsub = m_string_utils.gsub
local upper = m_string_utils.upper
local kana_to_romaji = require("Module:Hrkt-translit").tr

-- ]
-- ]
-- ]
-- ]
-- ]

function export.link(data, options)
	options = options or {}
	data.lang = data.lang or require'Module:languages'.getByCode'ja'

	local kana_for_rom = data.kana or data.lemma
	if not data.kana then
		data.lemma = data.lemma:gsub('', '')
	end

	local ruby
	if data.kana and data.lemma ~= data.kana then
		ruby = require('Module:ja-ruby').ruby_auto{
			term = data.lemma,
			kana = data.kana,
			options = options.rubyOptions,
		}
	else
		require("Module:debug").track('ja-link/no ruby')
		ruby = data.lemma
	end

	if ruby:match'%%]' then
		require("Module:debug").track('ja-link/manual wikilink')
		data.term = ruby
	elseif data.linkto == "" or data.linkto == "-" then
		require("Module:debug").track('ja-link/disabled link')
		data.alt = ruby
	else
		data.term = data.linkto or data.lemma:gsub('', '')
		data.alt = ruby
	end

	if data.tr ~= '-' then
		if not data.tr then
			data.tr = m_links.remove_links(kana_to_romaji(kana_for_rom, data.lang:getCode(), nil, {hist = options.hist}))
			if options.caps then
				require("Module:debug").track("ja-link/caps")
				data.tr = ugsub(data.tr, "%f%l", upper)
			end
		else
			if options.hist then require("Module:debug").track("ja-link/parameter hist unused") end
		end
		data.tr = require("Module:script utilities").tag_translit(data.tr, data.lang:getCode(), "term")
	end
	
	data.lemma = nil
	data.kana = nil
	data.linkto = nil

	return m_links.full_link(data, options.face, not options.disableSelfLink)
end

function export.show(frame)
	local alias_of_3 = {alias_of = 3}
	local boolean = {type = "boolean"}
	local args = require("Module:parameters").process(frame:getParent().args, {
		 = {required = true},
		 = true,
		 = true,
		 = alias_of_3,
		 = alias_of_3,
		 = {allow_empty = true},
		 = true,
		 = true,
		 = true,
		 = true,
		 = boolean,
		 = boolean,
		 = {type = "boolean", default = false},
	})

	return export.link({
		lang = frame.args and require'Module:languages'.getByCode(frame.args),
		lemma = args,
		kana = args,
		gloss = args,
		lit = args,
		pos = args,
		id = args,
		linkto = args,
		tr = args,
	}, {
		caps = args,
		hist = args,
		disableSelfLink = args,
	})
end

return export