Module:Infobox chord: Difference between revisions

TallKite (talk | contribs)
mNo edit summary
TallKite (talk | contribs)
bug fix
Line 40: Line 40:
local caption2 = "[[Color notation|Color name]]"
local caption2 = "[[Color notation|Color name]]"
-- search for ", " not "," because many chord names contain commas, e.g. Cz,y6
-- search for ", " not "," because many chord names contain commas, e.g. Cz,y6
if name:match(", ") then
if color_name:match(", ") then
caption2 = "[[Color notation|Color names]]"
caption2 = "[[Color notation|Color names]]"
-- removing manual line breaks
-- removing manual line breaks
local matches
local matches
name, matches = name:gsub("<br%s?/?>", "")
color_name, matches = color_name:gsub("<br%s?/?>", "")
if matches > 0 then
if matches > 0 then
cats = cats .. "[[Category:Todo:remove manual line breaks]]"
cats = cats .. "[[Category:Todo:remove manual line breaks]]"
end
end
-- replacing every comma+whitespace(s) instance with a line break
-- replacing every comma+whitespace(s) instance with a line break
name = name:gsub(",%s+", "<br />")
color_name = color_name:gsub(",%s+", "<br />")
end
end
table.insert(infobox_data, {
table.insert(infobox_data, {