mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 19:44:05 +00:00
Fixes #4529 - Order out of order ordered list ordering order
This commit is contained in:
committed by
Stefan Ceriu
parent
2deb746382
commit
3d5901f90d
@@ -206,6 +206,10 @@ struct AttributedStringBuilderV2: AttributedStringBuilderProtocol {
|
|||||||
|
|
||||||
case "ul", "ol":
|
case "ul", "ol":
|
||||||
var listIndex = 1
|
var listIndex = 1
|
||||||
|
if let startAttribute = try? childElement.attr("start"), let startIndex = Int(startAttribute) {
|
||||||
|
listIndex = startIndex
|
||||||
|
}
|
||||||
|
|
||||||
content = attributedString(element: childElement, documentBody: documentBody, preserveFormatting: preserveFormatting, listTag: tag, listIndex: &listIndex, indentLevel: indentLevel + 1)
|
content = attributedString(element: childElement, documentBody: documentBody, preserveFormatting: preserveFormatting, listTag: tag, listIndex: &listIndex, indentLevel: indentLevel + 1)
|
||||||
|
|
||||||
case "li":
|
case "li":
|
||||||
|
|||||||
@@ -753,6 +753,21 @@ class AttributedStringBuilderV1Tests: XCTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testOutOfOrderListNubmering() {
|
||||||
|
let htmlString = "<ol start=\"2\">\n<li>this is a two</li>\n</ol>"
|
||||||
|
|
||||||
|
guard let attributedString = attributedStringBuilder.fromHTML(htmlString) else {
|
||||||
|
XCTFail("Could not build the attributed string")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if AttributedStringBuilder.useNextGenHTMLParser {
|
||||||
|
XCTAssertEqual(String(attributedString.characters), " 2. this is a two")
|
||||||
|
} else {
|
||||||
|
XCTAssertEqual(String(attributedString.characters), "\t2.\tthis is a two")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - Phishing prevention
|
// MARK: - Phishing prevention
|
||||||
|
|
||||||
func testPhishingLink() {
|
func testPhishingLink() {
|
||||||
|
|||||||
Reference in New Issue
Block a user