Module:Dash: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
ArrowHead294 (talk | contribs)
No edit summary
ArrowHead294 (talk | contribs)
No edit summary
Line 23: Line 23:
end
end
local out_str = sp .. se .. sp
local out_str = frame.args["input_str"]:gsub(",%s+", sp .. se .. sp)
return "<span>" .. frame.args["input_str"]:gsub(",%s+", out_str) .. "</span>"
return "<span>" .. out_str .. "</span>"
end
end


return p
return p

Revision as of 11:18, 12 May 2024

Module documentation[view] [edit] [history] [purge]
This module should not be invoked directly; use its corresponding template instead: Template:Dash.

Replaces comma and space in list with dashes and spaces.

Introspection summary for Module:Dash 
Functions provided (1)
Line Function Params
3 dashes (invokable) (frame)
Lua modules required (0)
Variable Module Functions used

No function descriptions were provided. The Lua code may have further information.


local p = {}

function p.dashes(frame)
	local sp = ""
	local se = ""
	
	if frame.args["spaces"] == "thin" then
		sp = "&#x2009;"
	elseif frame.args["spaces"] == "hair" then
		sp = "&#x200A;"
	elseif frame.args["spaces"] == "space" then
		sp = " "
	else
		sp = ""
	end
	
	if frame.args["separator"] == "mdash" then
		se = "&mdash;"
	elseif frame.args["separator"] == "ndash" then
		se = "&ndash;"
	else
		se = "-"
	end
	
	local out_str = frame.args["input_str"]:gsub(",%s+", sp .. se .. sp)
	
	return "<span>" .. out_str .. "</span>"
end

return p