SimpleChatTCRV:Markdown:OrdUnOrded: EndType tracker initial go
This commit is contained in:
parent
9b75e494be
commit
2788752880
|
|
@ -25,6 +25,8 @@ export class MarkDown {
|
||||||
list: {
|
list: {
|
||||||
/** @type {Array<number>} */
|
/** @type {Array<number>} */
|
||||||
offsets: [],
|
offsets: [],
|
||||||
|
/** @type {Array<string>} */
|
||||||
|
endType: [],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
@ -36,8 +38,12 @@ export class MarkDown {
|
||||||
}
|
}
|
||||||
|
|
||||||
unwind_list_unordered() {
|
unwind_list_unordered() {
|
||||||
for(const i in this.in.list.offsets) {
|
while (true) {
|
||||||
this.html += "</ul>\n"
|
let popped = this.in.list.endType.pop()
|
||||||
|
if (popped == undefined) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
this.html += popped
|
||||||
}
|
}
|
||||||
this.in.list.offsets.length = 0
|
this.in.list.offsets.length = 0
|
||||||
}
|
}
|
||||||
|
|
@ -65,10 +71,12 @@ export class MarkDown {
|
||||||
this.in.list.offsets.push(curOffset)
|
this.in.list.offsets.push(curOffset)
|
||||||
listLvl = this.in.list.offsets.length
|
listLvl = this.in.list.offsets.length
|
||||||
this.html += "<ul>\n"
|
this.html += "<ul>\n"
|
||||||
|
this.in.list.endType.push("</ul>\n")
|
||||||
} else if (lastOffset > curOffset){
|
} else if (lastOffset > curOffset){
|
||||||
while (this.in.list.offsets[this.in.list.offsets.length-1] > curOffset) {
|
while (this.in.list.offsets[this.in.list.offsets.length-1] > curOffset) {
|
||||||
this.in.list.offsets.pop()
|
this.in.list.offsets.pop()
|
||||||
this.html += `</ul>\n`
|
let popped = this.in.list.endType.pop()
|
||||||
|
this.html += popped;
|
||||||
if (this.in.list.offsets.length == 0) {
|
if (this.in.list.offsets.length == 0) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue