Module:coinage

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

Implements {{coinage}}.


local export = {}
local m_utilities = require("Module:utilities")
local m_languages = require("Module:languages")

function export.coinage(frame)
	local args = frame:getParent().args
	
	local params = {
		 = {required = true, default = "und"},
		 = {required = true, default = "unknown"},
		
		 = {},		-- date: "in"
		 = {default = nil}, 		-- Wikipedia link target
		 = {},		-- nationality
		 = {list = true, default = nil},
		 = {default = nil},		-- alt text
		
		 = {},
		 = {list = true, default = nil},

		 = {type = "boolean"},

		 = {},
		 = {type = "boolean"},
		 = {type = "boolean"},
		 = {type = "boolean"},
		 = {type = "boolean"},
	}
	
	args = require("Module:parameters").process(args, params)
	
	local lang = m_languages.getByCode(args) or m_languages.err(args, 1)

    local coiner = args
    local wikilink = args or coiner
    local date = args
    
	local result = ""
	
	if not args then
		if args then
			result = result .. " and "c" or "C") .. "oined]] ] by "
		else
			result = result .. " and "c" or "C") .. "oined]] by "
		end
	end

    local nationality = args or args or nil
	local occupation = args
	if not occupation or #occupation < 1 then
		occupation = args
	end
    local nat_occ = ""
    
	if nationality then
		nat_occ = nat_occ .. nationality .. " "
	end
	if occupation and #occupation > 0 then
		nat_occ = nat_occ .. mw.text.listToText(occupation)
	end
    
    -- use Wikidata to get label and Wikipedia link if coiner looks like a QID
    if mw.wikibase and mw.ustring.match(coiner, "^Q%d+$") then
		wikilink = mw.wikibase.sitelink(coiner, 'enwiki')
		if nat_occ == "" then
			-- fall back to Wikidata description if nothing specified
			nat_occ = mw.wikibase.getDescription(coiner) or ""
			-- remove biographical "(born-died)", "(born YYYY)" information often present in Wikidata descriptions
			nat_occ = mw.ustring.gsub(nat_occ, "%(+%)$", "")
			nat_occ = mw.ustring.gsub(nat_occ, "%(born %d+%)", "")
			-- remove everything after the first semicolon
			nat_occ = string.gsub(nat_occ, ";.+$", "")
			
		end
		coiner = mw.wikibase.getLabel(coiner)
	end
		
	local coiner_text = args or coiner
	local link = coiner_text
    if wikilink and wikilink ~= "-" then
        -- create Wikipedia link
        -- default to title, or interpret as language code if a colon is present

        if mw.ustring.match(wikilink, ":$") then
        	-- just language code and a colon?
            wikilink = wikilink .. coiner
        end

        link = "]"
    end
	
	result = result .. nat_occ .. " " .. link
	
	if date then
		if mw.ustring.match(date, "^+$") -- year only
		or mw.ustring.match(date, "^")   -- month and year?
		or mw.ustring.match(date, "^the ")
		then
			result = result .. " in " .. date
		else -- assume alternative preposition was given
			result = result .. " " .. date
		end
	end
	
	local categories = {}
	if not args then
		if not args then
			table.insert(categories, lang:getCanonicalName() .. " terms coined by " .. coiner)
		end
		table.insert(categories, lang:getCanonicalName() .. " coinages")
		if args then
			table.insert(categories, lang:getCanonicalName() .. " terms coined ex nihilo")
		end
	end
    categories = m_utilities.format_categories(categories, lang, args)
	
	return result .. categories
end

return export