mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-25 02:00:10 +02:00
Merge pull request #19373 from overleaf/mj-comment-regex-fix
[web] Fix regex in comment matching GitOrigin-RevId: e341f13a9ccbe2fbc1ec6c6c1d8a7a11c4dd4e37
This commit is contained in:
committed by
Copybot
parent
9d665ffe65
commit
e897baee48
@@ -137,11 +137,6 @@ module.exports = MetaHandler = {
|
||||
* @returns {string}
|
||||
*/
|
||||
_getNonCommentedContent(rawLine) {
|
||||
const commentStart = /(?:^%)|(?:[^\\]%)/
|
||||
const match = rawLine.match(commentStart)
|
||||
if (match) {
|
||||
return rawLine.slice(0, match.index)
|
||||
}
|
||||
return rawLine
|
||||
return rawLine.replace(/(^|[^\\])%.*/, '$1')
|
||||
},
|
||||
}
|
||||
|
||||
@@ -197,9 +197,11 @@ describe('MetaHandler', function () {
|
||||
'two',
|
||||
// bbb should not be in the returned labels
|
||||
'commented label % \\label{bbb}',
|
||||
'\\label{ccc}%bar',
|
||||
'\\label{ddd} % bar',
|
||||
]
|
||||
this.fakeMeta = {
|
||||
labels: ['aaa'],
|
||||
labels: ['aaa', 'ccc', 'ddd'],
|
||||
packages: { abc: [] },
|
||||
packageNames: ['abc'],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user