@@ -174,16 +174,16 @@ function walk (opts, nodes) {
174174 return m
175175 }
176176
177+ const ignoredBefore = delimitersSettings [ 1 ] . text [ 0 ]
178+ const ignoredAfter = delimitersSettings [ 1 ] . text [ 1 ]
179+ const toReplace = new RegExp ( `@${ ignoredBefore } ` , 'g' )
180+ let ignoredExpression = new RegExp ( `@${ ignoredBefore } (.+?)${ ignoredAfter } ` , 'g' )
181+
177182 // if we have a string, match and replace it
178183 if ( typeof node === 'string' ) {
179184 // if node contains ignored expression delimiter, output as-is
180- const before = delimitersSettings [ 1 ] . text [ 0 ]
181- const after = delimitersSettings [ 1 ] . text [ 1 ]
182- const ignoredDelimiter = new RegExp ( `@${ before } (.+?)${ after } ` , 'g' )
183-
184- if ( ignoredDelimiter . test ( node ) ) {
185- const toReplace = new RegExp ( `@${ before } ` , 'g' )
186- node = node . replace ( toReplace , before )
185+ if ( ignoredExpression . test ( node ) ) {
186+ node = node . replace ( toReplace , ignoredBefore )
187187
188188 m . push ( node )
189189
@@ -199,8 +199,14 @@ function walk (opts, nodes) {
199199
200200 // if not, we have an object, so we need to run the attributes and contents
201201 if ( node . attrs ) {
202+ // adapt regex to work with attribute values
203+ ignoredExpression = new RegExp ( `.*@${ ignoredBefore } (.+?)${ ignoredAfter } ` )
202204 for ( const key in node . attrs ) {
203- node . attrs [ key ] = placeholders ( node . attrs [ key ] , ctx , delimitersSettings )
205+ if ( ignoredExpression . test ( node . attrs [ key ] ) ) {
206+ node . attrs [ key ] = node . attrs [ key ] . replace ( toReplace , ignoredBefore )
207+ } else {
208+ node . attrs [ key ] = placeholders ( node . attrs [ key ] , ctx , delimitersSettings )
209+ }
204210 }
205211 }
206212
0 commit comments