Fix converter state not being reset

This commit is contained in:
Shadowfacts 2023-12-26 14:40:02 -05:00
parent b33be0f178
commit 64b68a6cec
2 changed files with 6 additions and 0 deletions

View File

@ -45,6 +45,8 @@ public struct AttributedStringConverter<Callbacks: HTMLConversionCallbacks> {
actionStack = [] actionStack = []
styleStack = [] styleStack = []
previouslyFinishedBlockElement = false
currentElementIsEmpty = true
currentRun = "" currentRun = ""
while let token = tokenizer.next() { while let token = tokenizer.next() {

View File

@ -31,6 +31,10 @@ public struct TextConverter<Callbacks: HTMLConversionCallbacks> {
tokenizer = Tokenizer(chars: html.unicodeScalars.makeIterator()) tokenizer = Tokenizer(chars: html.unicodeScalars.makeIterator())
str = "" str = ""
previouslyFinishedBlockElement = false
currentElementIsEmpty = true
currentRun = ""
while let token = tokenizer.next() { while let token = tokenizer.next() {
switch token { switch token {
case .character(let scalar): case .character(let scalar):