Module:taxlink2

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


local m_links = require('Module:links')

local export = {}

local italicized_ranks = {
	 = true,
	 = true,
	 = true,
	 = true,
	 = true,
	 = true,
	 = true,
	 = true,
	 = true,
	 = true,
	 = true,
	 = true,
	 = true
}

function page_exists(title)
	local link_object = mw.title.new(title) or nil
	if link_object then
		local link_id = link_object.id
		return link_object.id ~= 0 
	end
	return false			

end

function wikispecies_link(title, alt)
	local result = "[[Wikispecies:" .. title
	if alt then
		result = result .. "|" .. alt
	else
		result = result .. "|" .. title
	end
	return result .. "]]"
	
end

function export.main(frame)
	local params = {
		 = {required = true},
		 = {required = true},
		 = {},
		 = {type = "boolean"}
	}
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local lang = require('Module:languages').getByCode('mul')
	local taxon = args
	local rank = args
	local alt = args
	
	local result = ""
	
	local exists = page_exists(taxon)
	
	if not exists then
		result = wikispecies_link(taxon, alt)
	else
		result = m_links.full_link({lang = lang, term = taxon, alt=alt})
	end
	
	if italicized_ranks or args then
		result = require("Module:italics").i(result)
	end
	
	if exists then
		result = result .. "<sup>" .. wikispecies_link(taxon, "ws") .. "</sup>"
	else
		result = result .. "]"
	end
	
	return result
	
end


return export