Closed onato closed 6 years ago
Thanks for your idea. Please check new version of Atributika. I made TagTransformer more flexible, so it can be used now to support such things as ordered lists. General idea can be found here: https://github.com/psharanda/Atributika/blob/master/Tests/AtributikaTests/AtributikaTests.swift#L343
Awesome, that was super helpful. I got what I wanted with the following…
var counter = 0
var isOrdered = false
let transformers: [TagTransformer] = [
TagTransformer.brTransformer,
TagTransformer(tagName: "ul", tagType: .start) { _ in
isOrdered = false
return ""
},
TagTransformer(tagName: "ol", tagType: .start) { _ in
counter = 0
isOrdered = true
return ""
},
TagTransformer(tagName: "li", tagType: .start) { _ in
counter += 1
return isOrdered ? "\(counter). " : "• "
},
TagTransformer(tagName: "li", tagType: .end) { _ in
return "\n"
},
…
Any idea how I could render ordered lists
<ol>
with Atributika?