Module:qualifier: difference between revisions

From Wiktionary, the free dictionary
Jump to navigation Jump to search
Content deleted Content added
Should not allow holes.
undoing removal of lang parameter: I just saw some module errors caused by its presence, which should be avoided
Line 15: Line 15:
local params = {
local params = {
[1] = {list = true, required = true},
[1] = {list = true, required = true},
["lang"] = {},
}
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local args = require("Module:parameters").process(frame:getParent().args, params)
if args.lang then
-- [[Special:WhatLinksHere/Template:tracking/qualifier/lang]]
require("Module:debug").track("qualifier/lang")
end
return export.format_qualifier(args[1])
return export.format_qualifier(args[1])
Line 25: Line 31:
local params = {
local params = {
[1] = {list = true, required = true},
[1] = {list = true, required = true},
["lang"] = {},
}
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local args = require("Module:parameters").process(frame:getParent().args, params)
if args.lang then
-- [[Special:WhatLinksHere/Template:tracking/sense/lang]]
require("Module:debug").track("sense/lang")
end
return export.format_qualifier(args[1])
return export.format_qualifier(args[1])

Revision as of 20:31, 25 April 2017

A module for formatting lists of qualifiers ({{qualifier}}, {{sense}}, {{antsense}}).


local export = {}

function export.format_qualifier(list)
	if #list == 0 then
		return ''
	end

	return '<span class="ib-brac qualifier-brac">(</span>' ..
	       '<span class="ib-content qualifier-content">' ..
	       table.concat(list, '<span class="ib-comma qualifier-comma">,</span> ') ..
		   '</span><span class="ib-brac qualifier-brac">)</span>'
end

function export.qualifier_t(frame)
	local params = {
	   [1] = {list = true, required = true},
	   ["lang"] = {},
	}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	if args.lang then
		-- [[Special:WhatLinksHere/Template:tracking/qualifier/lang]]
		require("Module:debug").track("qualifier/lang")
	end
	
	return export.format_qualifier(args[1])
end

function export.sense_t(frame)
	local params = {
	   [1] = {list = true, required = true},
	   ["lang"] = {},
	}
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	if args.lang then
		-- [[Special:WhatLinksHere/Template:tracking/sense/lang]]
		require("Module:debug").track("sense/lang")
	end
	
	return export.format_qualifier(args[1])
		.. '<span class="ib-colon sense-qualifier-colon">:</span>'
end
	
return export