Module:Dash: Difference between revisions
Jump to navigation
Jump to search
ArrowHead294 (talk | contribs) mNo edit summary |
ArrowHead294 (talk | contribs) Try moving switch statements to module itself |
||
| Line 2: | Line 2: | ||
function p.dashes(frame) | function p.dashes(frame) | ||
local sp = "" | |||
local se = "" | |||
if frame.args["spaces"] == "thin" then | |||
sp = "\u{2009}" | |||
elseif frame.args["spaces"] == "hair" then | |||
sp = "\u{200A}" | |||
else | |||
sp = " " | |||
end | |||
if frame.args["separator"] == "mdash" then | |||
sp = "\u{2014}" | |||
elseif frame.args["separator"] == "ndash" then | |||
sp = "\u{2013}" | |||
else | |||
sp = "-" | |||
end | |||
return frame.args["input_str"]:gsub("%s+", sp .. se .. sp) | |||
end | end | ||
return p | return p | ||
Revision as of 03:17, 12 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["spaces"] == "thin" then
sp = "\u{2009}"
elseif frame.args["spaces"] == "hair" then
sp = "\u{200A}"
else
sp = " "
end
if frame.args["separator"] == "mdash" then
sp = "\u{2014}"
elseif frame.args["separator"] == "ndash" then
sp = "\u{2013}"
else
sp = "-"
end
return frame.args["input_str"]:gsub("%s+", sp .. se .. sp)
end
return p