mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
WIP: blank out label commands before running spell-check
This commit is contained in:
parent
1ecabaa611
commit
a1d2d5b313
1 changed files with 11 additions and 0 deletions
|
@ -53,6 +53,9 @@ define [
|
|||
@$scope.learnWord = (highlight) =>
|
||||
@learnWord(highlight)
|
||||
|
||||
# DEBUG
|
||||
window.BLANK = @blankOutBlacklistedCommands
|
||||
|
||||
runFullCheck: () ->
|
||||
@highlightedWordManager.clearRows()
|
||||
if @$scope.spellCheckLanguage and @$scope.spellCheckLanguage != ""
|
||||
|
@ -217,6 +220,7 @@ define [
|
|||
words = []
|
||||
positions = []
|
||||
for line, row in lines
|
||||
line = @blankOutBlacklistedCommands(line)
|
||||
if !linesToProcess? or linesToProcess[row]
|
||||
# Regex generated from /\\?['\p{L}]+/g via https://mothereff.in/regexpu.
|
||||
# \p{L} matches unicode characters in the 'letter' category, but is not supported until ES6.
|
||||
|
@ -246,3 +250,10 @@ define [
|
|||
error: (xhr, status, error) ->
|
||||
callback error
|
||||
return $.ajax options
|
||||
|
||||
blankOutBlacklistedCommands: (line) ->
|
||||
line.replace /\\label(\[[^\]]*\])?{[^}]*}/g, (command) ->
|
||||
command = command.replace /{.*}/, (args) ->
|
||||
'{' + args.slice(1, args.length-1).split('').map((_char)-> '.').join('') + '}'
|
||||
command.replace /\[.*\]/, (args) ->
|
||||
'[' + args.slice(1, args.length-1).split('').map((_char)-> '.').join('') + ']'
|
||||
|
|
Loading…
Reference in a new issue