File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { parseDrawing } from './drawing.js';
22import { parseTags } from './tags.js' ;
33
44export function parseText ( text ) {
5- const pairs = text . split ( / { ( [ ^ { } ] * ?) } / ) ;
5+ const pairs = text . split ( / { ( . * ?) } / ) ;
66 const parsed = [ ] ;
77 if ( pairs [ 0 ] . length ) {
88 parsed . push ( { tags : [ ] , text : pairs [ 0 ] , drawing : [ ] } ) ;
Original file line number Diff line number Diff line change @@ -64,4 +64,12 @@ describe('text parser', () => {
6464 it ( 'should detect whether it is drawing' , ( ) => {
6565 expect ( parseText ( '{\\p1\\p0}m 0 0 l 1 0' ) . parsed [ 0 ] . drawing ) . to . deep . equal ( [ ] ) ;
6666 } ) ;
67+
68+ it ( 'should handle mismatched brackets' , ( ) => {
69+ expect ( parseText ( '{ a { b }c' ) ) . to . deep . equal ( {
70+ raw : '{ a { b }c' ,
71+ combined : 'c' ,
72+ parsed : [ { tags : [ ] , text : 'c' , drawing : [ ] } ] ,
73+ } ) ;
74+ } ) ;
6775} ) ;
You can’t perform that action at this time.
0 commit comments