File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -224,4 +224,10 @@ describe('VARIABLE_REGEXP', () => {
224224 it ( 'should match against colons with non-english characters' , ( ) => {
225225 expect ( '<<glossary:ラベル>>' ) . toMatch ( new RegExp ( VARIABLE_REGEXP ) ) ;
226226 } ) ;
227+
228+ it ( 'should NOT match against newlines' , ( ) => {
229+ expect ( '<<what the\nfuck>>' ) . not . toMatch ( new RegExp ( VARIABLE_REGEXP ) ) ;
230+ expect ( '<<what the\rfuck>>' ) . not . toMatch ( new RegExp ( VARIABLE_REGEXP ) ) ;
231+ expect ( '<<what the\r\nfuck>>' ) . not . toMatch ( new RegExp ( VARIABLE_REGEXP ) ) ;
232+ } ) ;
227233} ) ;
Original file line number Diff line number Diff line change @@ -185,6 +185,6 @@ module.exports.Variable = Variable;
185185// - \<<apiKey\>> - escaped variables
186186// - <<apiKey>> - regular variables
187187// - <<glossary:glossary items>> - glossary
188- module . exports . VARIABLE_REGEXP = / (?: \\ ) ? < < ( [ - _ \p{ L} : . \s \d ] + ) (?: \\ ) ? > > / iu. source ;
188+ module . exports . VARIABLE_REGEXP = / (?: \\ ) ? < < ( (?: (? ! [ \r \n ] ) [ - _ \p{ L} : . \s \d ] ) + ) (?: \\ ) ? > > / iu. source ;
189189module . exports . VariablesContext = VariablesContext ;
190190module . exports . SelectedAppContext = SelectedAppContext ;
You can’t perform that action at this time.
0 commit comments