@@ -177,12 +177,13 @@ function walk (opts, nodes) {
177177 const ignoredBefore = delimitersSettings [ 1 ] . text [ 0 ]
178178 const ignoredAfter = delimitersSettings [ 1 ] . text [ 1 ]
179179 const toReplace = new RegExp ( `@${ ignoredBefore } ` , 'g' )
180- let ignoredExpression = new RegExp ( `@${ ignoredBefore } (.+?)${ ignoredAfter } ` , 'g' )
180+ const ignoredNodeExpression = new RegExp ( `@${ ignoredBefore } (.+?)${ ignoredAfter } ` , 'g' )
181+ const ignoredAttrsExpression = new RegExp ( `.*@${ ignoredBefore } (.+?)${ ignoredAfter } ` )
181182
182183 // if we have a string, match and replace it
183184 if ( typeof node === 'string' ) {
184185 // if node contains ignored expression delimiter, output as-is
185- if ( ignoredExpression . test ( node ) ) {
186+ if ( ignoredNodeExpression . test ( node ) ) {
186187 node = node . replace ( toReplace , ignoredBefore )
187188
188189 m . push ( node )
@@ -199,10 +200,8 @@ function walk (opts, nodes) {
199200
200201 // if not, we have an object, so we need to run the attributes and contents
201202 if ( node . attrs ) {
202- // adapt regex to work with attribute values
203- ignoredExpression = new RegExp ( `.*@${ ignoredBefore } (.+?)${ ignoredAfter } ` )
204203 for ( const key in node . attrs ) {
205- if ( ignoredExpression . test ( node . attrs [ key ] ) ) {
204+ if ( ignoredAttrsExpression . test ( node . attrs [ key ] ) ) {
206205 node . attrs [ key ] = node . attrs [ key ] . replace ( toReplace , ignoredBefore )
207206 } else {
208207 node . attrs [ key ] = placeholders ( node . attrs [ key ] , ctx , delimitersSettings )
0 commit comments