You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dollar signs in the the file contents seem to require escaping, but seems like unintended behaviour since matches are dropped into the rendered string:
constrenderLayouts=require('layouts')constfile={contents: Buffer.from('<div>A $100 layout!!!</div>'),layout: 'one',}constlayoutCollection={one: {contents: Buffer.from('{% body %}')},}constres=renderLayouts(file,layoutCollection)console.log(res.contents.toString())
yields
<div>A body00 layout!!!</div>
Escaping the dollar sign works:
constrenderLayouts=require('layouts')constfile={contents: Buffer.from('<div>A $$100 layout!!!</div>'),layout: 'one',}constlayoutCollection={one: {contents: Buffer.from('{% body %}')},}constres=renderLayouts(file,layoutCollection)console.log(res.contents.toString())
Although the issue is compounded when nesting layouts, and requires multiple escape characters:
constrenderLayouts=require('layouts')constfile={contents: Buffer.from('<div>Wrap me with $$$$100 a layout!!!</div>'),layout: 'one',}constlayoutCollection={one: {contents: Buffer.from('one before\n{% body %}\none after'),layout: 'two'},two: {contents: Buffer.from('two before\n{% body %}\ntwo after')},}constres=renderLayouts(file,layoutCollection)console.log(res.contents.toString())
will yield:
two before
one before
<div>Wrap me with $100 a layout!!!</div>
one after
two after
Is there a recommended way of dealing with this? If it's a bug I might be able to put together a PR
NodeJS v10.15.3
layouts@3.0.1
The text was updated successfully, but these errors were encountered:
Dollar signs in the the file contents seem to require escaping, but seems like unintended behaviour since matches are dropped into the rendered string:
yields
Escaping the dollar sign works:
Although the issue is compounded when nesting layouts, and requires multiple escape characters:
will yield:
Is there a recommended way of dealing with this? If it's a bug I might be able to put together a PR
NodeJS v10.15.3
layouts@3.0.1
The text was updated successfully, but these errors were encountered: