Skip to content

Commit a41d881

Browse files
author
Gerardo
committed
Update MarkConverter to remove extra spaces within the style attribute
1 parent 8712387 commit a41d881

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Aztec/Classes/Converters/StringAttributesToAttributes/Implementations/MarkStringAttributeConverter.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ open class MarkStringAttributeConverter: StringAttributeConverter {
1919
//
2020

2121
if let elementNode = attributes.storedElement(for: NSAttributedString.Key.markHtmlRepresentation) {
22+
let styleAttribute = elementNode.attributes.first(where: { $0.name == "style" })
23+
if let elementStyle = styleAttribute?.value.toString() {
24+
// Remove spaces between attribute name and value, and between style attributes.
25+
let styleAttributes = elementStyle.replacingOccurrences(of: ": ", with: ":").replacingOccurrences(of: "; ", with: ";")
26+
elementNode.attributes["style"] = .string(styleAttributes)
27+
}
2228
elementNodes.append(elementNode)
2329
}
2430

0 commit comments

Comments
 (0)