mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
More robust regex for matching/parsing labels.
- limit label name to max 80 characters - don't use `.*` - limit total labels per document to 1000
This commit is contained in:
parent
a363b62f23
commit
1ba8b702ad
1 changed files with 2 additions and 2 deletions
|
@ -26,8 +26,8 @@ define [
|
|||
docId = @ide.editorManager.getCurrentDocId()
|
||||
docText = @ide.editorManager.getCurrentDocValue()
|
||||
labels = []
|
||||
re = /\\label{(.*)}/g
|
||||
while labelMatch = re.exec(docText)
|
||||
re = /\\label\{([^\}\n\\]{0,80})\}/g
|
||||
while (labelMatch = re.exec(docText)) and labels.length < 1000
|
||||
if labelMatch[1]
|
||||
labels.push(labelMatch[1])
|
||||
@state.documents[docId] = labels
|
||||
|
|
Loading…
Reference in a new issue