mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #16397 from overleaf/mj-logparser-missed-error
[web] Stop wrapping potential errors into previous log lines GitOrigin-RevId: 892fc19e2e7886afa3dc011315879fa992f94877
This commit is contained in:
parent
45274d9dff
commit
d7a4061486
3 changed files with 36 additions and 2 deletions
|
@ -346,16 +346,21 @@ class LogText {
|
||||||
// append this line to it.
|
// append this line to it.
|
||||||
// Some lines end with ... when LaTeX knows it's hit the limit
|
// Some lines end with ... when LaTeX knows it's hit the limit
|
||||||
// These shouldn't be wrapped.
|
// These shouldn't be wrapped.
|
||||||
|
// If the next line looks like it could be an error (i.e. start with a !),
|
||||||
|
// do not unwrap the line.
|
||||||
const prevLine = wrappedLines[i - 1]
|
const prevLine = wrappedLines[i - 1]
|
||||||
const currentLine = wrappedLines[i]
|
const currentLine = wrappedLines[i]
|
||||||
|
|
||||||
if (prevLine.length === LOG_WRAP_LIMIT && prevLine.slice(-3) !== '...') {
|
if (
|
||||||
|
prevLine.length === LOG_WRAP_LIMIT &&
|
||||||
|
prevLine.slice(-3) !== '...' &&
|
||||||
|
currentLine.charAt(0) !== '!'
|
||||||
|
) {
|
||||||
this.lines[this.lines.length - 1] += currentLine
|
this.lines[this.lines.length - 1] += currentLine
|
||||||
} else {
|
} else {
|
||||||
this.lines.push(currentLine)
|
this.lines.push(currentLine)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.row = 0
|
this.row = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023) (preloaded format=latex 2023.8.28) 4 JAN 2024 10:26
|
||||||
|
entering extended mode
|
||||||
|
\write18 enabled.
|
||||||
|
%&-line parsing enabled.
|
||||||
|
**main.tex
|
||||||
|
(./main.tex
|
||||||
|
LaTeX2e <2023-06-01> patch level 1
|
||||||
|
L3 programming layer <2023-06-30>
|
||||||
|
(Font) Font shape `OT1/cmss/m/sl' tried instead on input line 100.
|
||||||
|
! Undefined control sequence.
|
||||||
|
l.102 but here: "\anUndefinedCommand
|
||||||
|
" lorem ipsum ...
|
||||||
|
The control sequence at the end of the top line
|
||||||
|
of your error message was never \def'ed. If you have
|
||||||
|
misspelled it (e.g., `\hobx'), type `I' and the correct
|
||||||
|
spelling (e.g., `I\hbox'). Otherwise just continue,
|
||||||
|
and I'll forget about whatever was undefined.
|
||||||
|
|
||||||
|
Output written on output.dvi (1 page, 796 bytes).
|
|
@ -417,6 +417,16 @@ describe('logParser', function (done) {
|
||||||
[8, 'LaTeX Error: Illegal character in array arg.', './main.tex'],
|
[8, 'LaTeX Error: Illegal character in array arg.', './main.tex'],
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should not unwrap errors into previous line', function () {
|
||||||
|
const { errors, warnings } = parseLatexLog(
|
||||||
|
'lncs-undefined-control-sequence.log'
|
||||||
|
)
|
||||||
|
expect(warnings).to.be.empty
|
||||||
|
expect(errors.map(x => [x.line, x.message, x.file])).to.deep.equal([
|
||||||
|
[102, 'Undefined control sequence.', './main.tex'],
|
||||||
|
])
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
function readLog(filename) {
|
function readLog(filename) {
|
||||||
|
|
Loading…
Reference in a new issue