mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2025-01-22 16:16:51 +00:00
Fix display text separators being recognised as table row separators
This commit is contained in:
parent
09fa2b0716
commit
cec494da30
@ -30,12 +30,18 @@ func (t *Table) Process(line string) (shouldGoBackToNormal bool) {
|
|||||||
t.pushRow()
|
t.pushRow()
|
||||||
}
|
}
|
||||||
var (
|
var (
|
||||||
|
inLink bool
|
||||||
|
skipNext bool
|
||||||
escaping bool
|
escaping bool
|
||||||
lookingForNonSpace = !t.inMultiline
|
lookingForNonSpace = !t.inMultiline
|
||||||
countingColspan bool
|
countingColspan bool
|
||||||
)
|
)
|
||||||
for i, r := range line {
|
for i, r := range line {
|
||||||
switch {
|
switch {
|
||||||
|
case skipNext:
|
||||||
|
skipNext = false
|
||||||
|
continue
|
||||||
|
|
||||||
case lookingForNonSpace && unicode.IsSpace(r):
|
case lookingForNonSpace && unicode.IsSpace(r):
|
||||||
case lookingForNonSpace && (r == '!' || r == '|'):
|
case lookingForNonSpace && (r == '!' || r == '|'):
|
||||||
t.currCellMarker = r
|
t.currCellMarker = r
|
||||||
@ -50,6 +56,12 @@ func (t *Table) Process(line string) (shouldGoBackToNormal bool) {
|
|||||||
|
|
||||||
case escaping:
|
case escaping:
|
||||||
t.currCellBuilder.WriteRune(r)
|
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 == '}':
|
case t.inMultiline && r == '}':
|
||||||
t.inMultiline = false
|
t.inMultiline = false
|
||||||
@ -69,6 +81,10 @@ func (t *Table) Process(line string) (shouldGoBackToNormal bool) {
|
|||||||
case r == '{':
|
case r == '{':
|
||||||
t.inMultiline = true
|
t.inMultiline = true
|
||||||
countingColspan = false
|
countingColspan = false
|
||||||
|
case r == '[' && len(line)-1 > i && line[i+1] == '[':
|
||||||
|
t.currCellBuilder.WriteString("[[")
|
||||||
|
inLink = true
|
||||||
|
skipNext = true
|
||||||
case i == len(line)-1:
|
case i == len(line)-1:
|
||||||
t.pushCell()
|
t.pushCell()
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user