@@ -431,12 +431,11 @@ describe("FormattedTextParserTests", () => {
431
431
} ,
432
432
] ) ;
433
433
} ) ;
434
- it ( "Default reader directives" , ( ) => {
434
+ it ( "Default reader directives (parentheses) " , ( ) => {
435
435
const textToFormat =
436
436
"This (Emphasize) equation is proportional to (read slowly) a minus x, plus (pause) 1." ;
437
437
const result : IFormattedText [ ] = FormattedTextParser . parseFormattedText ( textToFormat , {
438
438
pronunciationGuideMarkers : [ "[" , "]" ] ,
439
- // readerDirectives: ["(emphasize)", "(read slowly)", "(pause)"],
440
439
} ) ;
441
440
expect ( result ) . to . deep . equal ( [
442
441
{
@@ -504,6 +503,78 @@ describe("FormattedTextParserTests", () => {
504
503
} ,
505
504
] ) ;
506
505
} ) ;
506
+ it ( "Default reader directives (square brackets)" , ( ) => {
507
+ const textToFormat =
508
+ "This [Emphasize] equation is proportional to [read Slowly] a minus x, plus [pause] 1." ;
509
+ const result : IFormattedText [ ] = FormattedTextParser . parseFormattedText ( textToFormat , {
510
+ pronunciationGuideMarkers : [ "(" , ")" ] ,
511
+ } ) ;
512
+ expect ( result ) . to . deep . equal ( [
513
+ {
514
+ text : "This " ,
515
+ bolded : false ,
516
+ emphasized : false ,
517
+ underlined : false ,
518
+ subscripted : false ,
519
+ superscripted : false ,
520
+ pronunciation : false ,
521
+ } ,
522
+ {
523
+ text : "[Emphasize]" ,
524
+ bolded : false ,
525
+ emphasized : false ,
526
+ underlined : false ,
527
+ subscripted : false ,
528
+ superscripted : false ,
529
+ pronunciation : true ,
530
+ } ,
531
+ {
532
+ text : " equation is proportional to " ,
533
+ bolded : false ,
534
+ emphasized : false ,
535
+ underlined : false ,
536
+ subscripted : false ,
537
+ superscripted : false ,
538
+ pronunciation : false ,
539
+ } ,
540
+ {
541
+ text : "[read Slowly]" ,
542
+ bolded : false ,
543
+ emphasized : false ,
544
+ underlined : false ,
545
+ subscripted : false ,
546
+ superscripted : false ,
547
+ pronunciation : true ,
548
+ } ,
549
+ {
550
+ text : " a minus x, plus " ,
551
+ bolded : false ,
552
+ emphasized : false ,
553
+ underlined : false ,
554
+ subscripted : false ,
555
+ superscripted : false ,
556
+ pronunciation : false ,
557
+ } ,
558
+ {
559
+ text : "[pause]" ,
560
+ bolded : false ,
561
+ emphasized : false ,
562
+ underlined : false ,
563
+ subscripted : false ,
564
+ superscripted : false ,
565
+ pronunciation : true ,
566
+ } ,
567
+ {
568
+ text : " 1." ,
569
+ bolded : false ,
570
+ emphasized : false ,
571
+ underlined : false ,
572
+ subscripted : false ,
573
+ superscripted : false ,
574
+ pronunciation : false ,
575
+ } ,
576
+ ] ) ;
577
+ } ) ;
507
578
it ( "Explicit reader directives" , ( ) => {
508
579
const textToFormat = "This (Emphasize) equation is proportional to (slowly) a minus x, plus (pause) 1." ;
509
580
const result : IFormattedText [ ] = FormattedTextParser . parseFormattedText ( textToFormat , {
0 commit comments