File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ function replaceElements(componentProps, formatted) {
101
101
var element = elements [ key ] ;
102
102
103
103
ret . forEach ( function ( string , i ) {
104
- var aux ;
104
+ var aux , contents , regexp , regexp2 ;
105
105
106
106
// Insert array into the correct ret position.
107
107
function replaceRetItem ( array ) {
@@ -119,6 +119,20 @@ function replaceElements(componentProps, formatted) {
119
119
replaceRetItem ( aux ) ;
120
120
return ; // continue;
121
121
}
122
+
123
+ // Start-end tags, e.g., `[foo]content[/foo]`.
124
+ regexp = new RegExp ( "\\[" + key + "\\][\\s\\S]*?\\[\\/" + key + "\\]" , "g" ) ;
125
+ regexp2 = new RegExp ( "\\[" + key + "\\]([\\s\\S]*?)\\[\\/" + key + "\\]" ) ;
126
+ aux = string . split ( regexp ) ;
127
+ if ( aux . length > 1 ) {
128
+ contents = string . match ( regexp ) . map ( function ( content ) {
129
+ return content . replace ( regexp2 , "$1" ) ;
130
+ } ) ;
131
+ aux = spreadElementsInBetweenItems ( aux , function ( i ) {
132
+ return React . cloneElement ( element , { } , contents [ i ] ) ;
133
+ } ) ;
134
+ replaceRetItem ( aux ) ;
135
+ }
122
136
} ) ;
123
137
124
138
return ret ;
You can’t perform that action at this time.
0 commit comments