mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05: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:
parent
3ebab56455
commit
1f0e346bbc
2 changed files with 4 additions and 7 deletions
|
@ -137,11 +137,6 @@ module.exports = MetaHandler = {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
_getNonCommentedContent(rawLine) {
|
_getNonCommentedContent(rawLine) {
|
||||||
const commentStart = /(?:^%)|(?:[^\\]%)/
|
return rawLine.replace(/(^|[^\\])%.*/, '$1')
|
||||||
const match = rawLine.match(commentStart)
|
|
||||||
if (match) {
|
|
||||||
return rawLine.slice(0, match.index)
|
|
||||||
}
|
|
||||||
return rawLine
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,9 +197,11 @@ describe('MetaHandler', function () {
|
||||||
'two',
|
'two',
|
||||||
// bbb should not be in the returned labels
|
// bbb should not be in the returned labels
|
||||||
'commented label % \\label{bbb}',
|
'commented label % \\label{bbb}',
|
||||||
|
'\\label{ccc}%bar',
|
||||||
|
'\\label{ddd} % bar',
|
||||||
]
|
]
|
||||||
this.fakeMeta = {
|
this.fakeMeta = {
|
||||||
labels: ['aaa'],
|
labels: ['aaa', 'ccc', 'ddd'],
|
||||||
packages: { abc: [] },
|
packages: { abc: [] },
|
||||||
packageNames: ['abc'],
|
packageNames: ['abc'],
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue