mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-06 07:39:02 +02: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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user