mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Merge pull request #1495 from MarkQuach12:bugfix/tag-star-linter-warning
GitOrigin-RevId: 3d66ca34c16e2820e3051ce81ab67abba54cde13
This commit is contained in:
+13
-1
@@ -1107,12 +1107,24 @@ const InterpretTokens = function (
|
|||||||
seq === 'intertext' ||
|
seq === 'intertext' ||
|
||||||
seq === 'shortintertext' ||
|
seq === 'shortintertext' ||
|
||||||
seq === 'textnormal' ||
|
seq === 'textnormal' ||
|
||||||
seq === 'tag' ||
|
|
||||||
seq === 'reflectbox' ||
|
seq === 'reflectbox' ||
|
||||||
seq === 'textrm'
|
seq === 'textrm'
|
||||||
) {
|
) {
|
||||||
// next group will be in text mode regardless
|
// next group will be in text mode regardless
|
||||||
nextGroupMathMode = false
|
nextGroupMathMode = false
|
||||||
|
} else if (seq === 'tag') {
|
||||||
|
// next group will be in text mode regardless
|
||||||
|
nextGroupMathMode = false
|
||||||
|
// \tag* (unnumbered tag) - skip over the '*' so it doesn't reset
|
||||||
|
// nextGroupMathMode before the argument group is reached
|
||||||
|
const nextToken = Tokens[i + 1]
|
||||||
|
if (
|
||||||
|
nextToken &&
|
||||||
|
nextToken[1] === 'Text' &&
|
||||||
|
text.substring(nextToken[2], nextToken[3]) === '*'
|
||||||
|
) {
|
||||||
|
i = i + 1
|
||||||
|
}
|
||||||
} else if (seq === 'tikz') {
|
} else if (seq === 'tikz') {
|
||||||
// try to read any optional params [BAR]...., advance if found
|
// try to read any optional params [BAR]...., advance if found
|
||||||
const newPos = readOptionalGeneric(TokeniseResult, i)
|
const newPos = readOptionalGeneric(TokeniseResult, i)
|
||||||
|
|||||||
+12
@@ -350,6 +350,18 @@ describe('LatexLinter', function () {
|
|||||||
assert.equal(errors.length, 0)
|
assert.equal(errors.length, 0)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should accept math tag* commands', function () {
|
||||||
|
const { errors } = Parse(
|
||||||
|
'\\begin{align}\n\\pi=3 \\tag*{\\(\\dagger\\)}\n\\end{align}\n'
|
||||||
|
)
|
||||||
|
assert.equal(errors.length, 0)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should accept math tag* commands with $ math mode', function () {
|
||||||
|
const { errors } = Parse('$\\tag*{$abc$}$\n')
|
||||||
|
assert.equal(errors.length, 0)
|
||||||
|
})
|
||||||
|
|
||||||
it('should accept math \\def commands', function () {
|
it('should accept math \\def commands', function () {
|
||||||
const { errors } = Parse(
|
const { errors } = Parse(
|
||||||
'\\def\\peb[#1]{{\\left\\lfloor #1\\right\\rfloor}}'
|
'\\def\\peb[#1]{{\\left\\lfloor #1\\right\\rfloor}}'
|
||||||
|
|||||||
Reference in New Issue
Block a user