mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Move command-matching regex to the class level
This commit is contained in:
parent
0163ffc4bd
commit
85ddff15cb
1 changed files with 16 additions and 15 deletions
|
@ -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('') + '}'
|
||||
|
|
Loading…
Reference in a new issue