Improving log support in LaTeX parser
This commit is contained in:
@@ -184,19 +184,24 @@ public extension Parser {
|
||||
}
|
||||
// Finding Group2
|
||||
open = 1
|
||||
index += 1 // skipping `(`
|
||||
index += 6 // skipping `\\left(`
|
||||
let endg1 = index
|
||||
while open > 0 {
|
||||
guard index < out.count else { return latex }
|
||||
if out[index] == "(" {
|
||||
guard index + 6 < out.count else { return latex }
|
||||
if out[index..<index + 6] == "\\left(" {
|
||||
open += 1
|
||||
} else if out[index] == ")" {
|
||||
index += 5
|
||||
} else if out[index...index + 6] == "\\right)" {
|
||||
open -= 1
|
||||
index += 6
|
||||
}
|
||||
index += 1
|
||||
}
|
||||
let g2start = out.index(out.startIndex, offsetBy: endg1)
|
||||
let g2end = out.index(out.startIndex, offsetBy: index - 1)
|
||||
let g2end = out.index(out.startIndex, offsetBy: index - 7)
|
||||
|
||||
guard g2start < g2end else { return latex }
|
||||
|
||||
let group2 = out[g2start..<g2end]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user