If you feel like making a pull request, I’d happily merge it
It doesn’t solve this issue but having duplicate styling is wasteful and bug-prone anyways.
I would make some slight tweaks to the deduplicate_style
function, mostly to make sure both the key
and the values
are present.
def deduplicate_style(style)
styles = {}
style
.split(";")
.select(&:present?)
.map { _1.split(":", 2).map(&:strip) }
.each { |k, v| styles[k] = v if k.present? && v.present? }
styles.map { |k, v| "#{k}:#{v}" }.join(";")
end