1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-01-06 10:00:26 +00:00

Fix display text separators being recognised as table row separators

This commit is contained in:
bouncepaw 2021-01-10 18:33:36 +05:00
parent 09fa2b0716
commit cec494da30

View File

@ -30,12 +30,18 @@ func (t *Table) Process(line string) (shouldGoBackToNormal bool) {
t.pushRow()
}
var (
inLink bool
skipNext bool
escaping bool
lookingForNonSpace = !t.inMultiline
countingColspan bool
)
for i, r := range line {
switch {
case skipNext:
skipNext = false
continue
case lookingForNonSpace && unicode.IsSpace(r):
case lookingForNonSpace && (r == '!' || r == '|'):
t.currCellMarker = r
@ -50,6 +56,12 @@ func (t *Table) Process(line string) (shouldGoBackToNormal bool) {
case escaping:
t.currCellBuilder.WriteRune(r)
case inLink && r == ']' && len(line)-1 > i && line[i+1] == ']':
t.currCellBuilder.WriteString("]]")
inLink = false
skipNext = true
case inLink:
t.currCellBuilder.WriteRune(r)
case t.inMultiline && r == '}':
t.inMultiline = false
@ -69,6 +81,10 @@ func (t *Table) Process(line string) (shouldGoBackToNormal bool) {
case r == '{':
t.inMultiline = true
countingColspan = false
case r == '[' && len(line)-1 > i && line[i+1] == '[':
t.currCellBuilder.WriteString("[[")
inLink = true
skipNext = true
case i == len(line)-1:
t.pushCell()
default: