steveire / grantlee

Libraries for text templating with Qt
Other
141 stars 50 forks source link

Not full escape features #63

Closed tiamatenko closed 3 years ago

tiamatenko commented 4 years ago

I've figured out that Grantlee does not support all escape features which are described here: lack of conversion double quote. Therefore Grantlee cannot generate XML of HTML-code if a variable comprises double-quotes. MB, I was doing something wrong. But it looks like just adding one line into OutputStream::escape() will fix it: temp.replace(QLatin1Char('"'), QStringLiteral("""));

I've done it on my side and it works as intended now. Of course, I broke tests but it seems this is the correct fix.

tiamatenko commented 4 years ago

I've found this quite old pull request which fixes this issue. It's strange why it's not in the master branch yet.

bothorsen commented 3 years ago

We have a similar patch in our build tree.

It's used for the SpaceCreator project we (Viking Software) are building for the European Space Agency. I have attached our version of the patch to fix the " escapes here. The only pull request may be better, but this one is needed for us.

I hope you will either add the original PR or use this patch (attached as txt, since this page won't allow patch uploads) grantlee_fix_escape.txt

dantti commented 3 years ago

I gave up on waiting for patch to be applied it's now under my fork https://github.com/cutelyst/cutelee/commit/8f7cc10d31f4291a15835a9844d69ce2448470bb The PR #8 that I created is much faster than the current code.

bothorsen commented 3 years ago

dantti, if you want to keep a fork og Grantlee going, then you should keep merging in the current work Steve is doing.

steveire commented 3 years ago

Done, thanks.