@@ -42,6 +42,46 @@ describe('parser tests', (): void => {
42
42
] ,
43
43
] ) ;
44
44
} ) ;
45
+ it ( 'classic markup test II' , ( ) : void => {
46
+ expect (
47
+ parse (
48
+ 'foo I(bar) baz C( bam ) B( ( boo ) ) U(https://example.com/?foo=bar)HORIZONTALLINE L(foo , https://bar.com) R( a , b )M(foo.bar.baz)HORIZONTALLINEx M(foo.bar.baz.bam)' ,
49
+ { only_classic_markup : true } ,
50
+ ) ,
51
+ ) . toEqual ( [
52
+ [
53
+ { type : PartType . TEXT , text : 'foo ' } ,
54
+ { type : PartType . ITALIC , text : 'bar' } ,
55
+ { type : PartType . TEXT , text : ' baz ' } ,
56
+ { type : PartType . CODE , text : ' bam ' } ,
57
+ { type : PartType . TEXT , text : ' ' } ,
58
+ { type : PartType . BOLD , text : ' ( boo ' } ,
59
+ { type : PartType . TEXT , text : ' ) ' } ,
60
+ { type : PartType . URL , url : 'https://example.com/?foo=bar' } ,
61
+ { type : PartType . HORIZONTAL_LINE } ,
62
+ { type : PartType . TEXT , text : ' ' } ,
63
+ { type : PartType . LINK , text : 'foo' , url : 'https://bar.com' } ,
64
+ { type : PartType . TEXT , text : ' ' } ,
65
+ { type : PartType . RST_REF , text : ' a' , ref : 'b ' } ,
66
+ { type : PartType . MODULE , fqcn : 'foo.bar.baz' } ,
67
+ { type : PartType . TEXT , text : 'HORIZONTALLINEx ' } ,
68
+ { type : PartType . MODULE , fqcn : 'foo.bar.baz.bam' } ,
69
+ ] ,
70
+ ] ) ;
71
+ } ) ;
72
+ it ( 'semantic markup test' , ( ) : void => {
73
+ expect ( parse ( 'foo E(a\\),b) P(foo.bar.baz , bam) baz V( b\\,\\na\\)\\\\m\\, ) ' ) ) . toEqual ( [
74
+ [
75
+ { type : PartType . TEXT , text : 'foo ' } ,
76
+ { type : PartType . ENV_VARIABLE , name : 'a),b' } ,
77
+ { type : PartType . TEXT , text : ' ' } ,
78
+ { type : PartType . PLUGIN , plugin : { fqcn : 'foo.bar.baz' , type : 'bam' } } ,
79
+ { type : PartType . TEXT , text : ' baz ' } ,
80
+ { type : PartType . OPTION_VALUE , value : ' b,na)\\m, ' } ,
81
+ { type : PartType . TEXT , text : ' ' } ,
82
+ ] ,
83
+ ] ) ;
84
+ } ) ;
45
85
it ( 'bad parameter parsing (no escaping, throw error)' , ( ) : void => {
46
86
expect ( async ( ) => parse ( 'M(' , { errors : 'exception' } ) ) . rejects . toThrow (
47
87
'While parsing M() at index 1: Cannot find closing ")" after last parameter' ,
0 commit comments