Module:Dash: Difference between revisions
Jump to navigation
Jump to search
ArrowHead294 (talk | contribs) No edit summary |
ArrowHead294 (talk | contribs) No edit summary |
||
| Line 6: | Line 6: | ||
if frame.args["s"] == "thin" then | if frame.args["s"] == "thin" then | ||
sp = " " -- U+2009 THIN SPACE | |||
elseif frame.args["s"] == "hair" then | elseif frame.args["s"] == "hair" then | ||
sp = " " | sp = " " -- U+200A HAIR SPACE | ||
elseif frame.args["s"] == "space" then | elseif frame.args["s"] == "space" then | ||
sp = " " | sp = " " -- Regular space | ||
else | else | ||
sp = "" | sp = "" -- No space | ||
end | end | ||
if frame.args["d"] == "long" then | if frame.args["d"] == "long" then | ||
se = "& | se = "—" -- U+2014 EM DASH | ||
elseif frame.args["d"] == "med" or frame.args["d"] == "medium" then | elseif frame.args["d"] == "med" or frame.args["d"] == "medium" then | ||
se = "& | se = "–" -- U+2013 EN DASH | ||
else | else | ||
se = "-" | se = "-" -- Hyphen-minus | ||
end | end | ||
Revision as of 18:39, 17 May 2024
- 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 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||
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["s"] == "thin" then
sp = " " -- U+2009 THIN SPACE
elseif frame.args["s"] == "hair" then
sp = " " -- U+200A HAIR SPACE
elseif frame.args["s"] == "space" then
sp = " " -- Regular space
else
sp = "" -- No space
end
if frame.args["d"] == "long" then
se = "—" -- U+2014 EM DASH
elseif frame.args["d"] == "med" or frame.args["d"] == "medium" then
se = "–" -- U+2013 EN DASH
else
se = "-" -- Hyphen-minus
end
local out_str = frame.args["input_str"]:gsub(",%s+", sp .. se .. sp)
return "<span>" .. out_str .. "</span>"
end
return p