From 85ddff15cb6b29231abe17be690f422607c99197 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 16 Jun 2017 10:20:55 +0100 Subject: [PATCH] Move command-matching regex to the class level --- .../spell-check/SpellCheckManager.coffee | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/SpellCheckManager.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/SpellCheckManager.coffee index 0e203d66e0..21866686cf 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/SpellCheckManager.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/SpellCheckManager.coffee @@ -251,22 +251,23 @@ define [ callback error return $.ajax options + blacklistedCommandRegex: /// + \\ # initial backslash + (label # any of these commands + |[a-z]{0,2}ref + |usepackage + |begin + |end + |[a-z]{0,2}cite + |input + |include + |includegraphics) + ( \[ [^\]]* \] )? # optional [...] args + \{ [^}]* \} # the {...} args + ///g + blankOutBlacklistedCommands: (line) -> - commandRegex = /// - \\ # initial backslash - (label # any of these commands - |[a-z]{0,2}ref - |usepackage - |begin - |end - |[a-z]{0,2}cite - |input - |include - |includegraphics) - ( \[ [^\]]* \] )? # optional [...] args - \{ [^}]* \} # the {...} args - ///g - line.replace commandRegex, (command) -> + line.replace @blacklistedCommandRegex, (command) -> command.replace( /{.*}/, (args) -> '{' + args.slice(1, args.length-1).split('').map((_char)-> '.').join('') + '}'