From 0163ffc4bd5304b34dea40ab50977e45edd02163 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 16 Jun 2017 10:17:30 +0100 Subject: [PATCH] Extend, and clean up the command-matching regex --- .../spell-check/SpellCheckManager.coffee | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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 f7ff1ead0d..0e203d66e0 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 @@ -252,7 +252,21 @@ define [ return $.ajax options blankOutBlacklistedCommands: (line) -> - line.replace /\\(label|ref|usepackage|begin|end)(\[[^\]]*\])?{[^}]*}/g, (command) -> + 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) -> command.replace( /{.*}/, (args) -> '{' + args.slice(1, args.length-1).split('').map((_char)-> '.').join('') + '}'