Skip to content

Commit

Permalink
text-minimessage: pop all at end in strict mode
Browse files Browse the repository at this point in the history
  • Loading branch information
zml2008 committed Feb 24, 2022
1 parent 98ac2d5 commit 02fe3f1
Showing 1 changed file with 11 additions and 1 deletion.
Expand Up @@ -57,7 +57,7 @@ private MiniMessageSerializer() {
visit(component, emitter, resolver, true);
if (strict) {
// If we are in strict mode, we need to close all tags at the end of our serialization journey
emitter.popToMark();
emitter.popAll();
}

return sb.toString();
Expand Down Expand Up @@ -137,6 +137,16 @@ void popToMark() {
}
}

void popAll() {
this.completeTag();
while (this.tagLevel > 0) {
final String tag = this.activeTags[--this.tagLevel];
if (tag != MARK) {
this.emitClose(tag);
}
}
}

void completeTag() {
if (this.midTag) {
this.consumer.append(TokenParser.TAG_END);
Expand Down

0 comments on commit 02fe3f1

Please sign in to comment.