Strange Substitution Issue
schetnikovich opened this issue · 2 comments
In the latest Marko versions and in some cases and
words in templates are replaced with &&
symbols.
For this template:
We're young.
<div>
You and me are friends and teammates.
</div>
The following *.marko.js
file will be generated:
out.w('We\'re\' \'young. <div>You && me are friends && teammates.</div><div style="color:blue">You '
Necessary Conditions
- You should use
marko-layout
module. - You should have unpaired
'
symbol in your template.
There are probably other conditions, when this issue happens, but I know only one set of conditions.
Minimal project
Here I prepared a minimal project that will help to reproduce this issue:
https://github.com/schetnikovich/marko-substitution-poltergeist
Reasons
I don't know actual reason of this problem, but for the end user this is because of '
symbol, that
makes all subsequent and
words be replaced by &&
symbol.
If you'll "close" single quotes, i.e. We'are' young
- everything will be correct.
Workaround
Replace all single quotes with the following:
$("'")
New version of marko published with fix: marko@2.2.2
Thanks for setting up the project to reproduce the problem and thank you for bringing this problem to our attention!
Thank you very much for so quick fix! Issue disappeared.