Closed CraigRobertWhite closed 3 years ago
The TravisCI testing has stopped working. We need to switch to GitHub Actions. I started https://github.com/peterbe/premailer/pull/253
I forgot that this package supported Python versions pre-walrus. Going to fix asap. Sorry about that.
Yeah, I knew that was going to happen :) The walrus syntax is neat and this new feature you're adding is opt-in but from a quick skim, if you can just rewrite in a "old school" way it would alleviate the problem for another couple of years.
@peterbe I'm not crazy about this implementation without the walrus operator but it works. If you have any room for improvement, I'd definitely be willing to implement it. Also, I'm also totally cool with squash merging this PR, haha.
Sorry about the multiple commits for fixing formatting.
Hey, as a general comment the tests look great (apart from the note about making the 2 unit tests into 1).
I don't know if I understand the unquote
and unescape
and all that but the tests clearly prove that what comes out of the other end is sane and desired. I expected it to be a bit weird because HTML + Handlebar isn't HTML so hacking around it is the only sensible option. I've seen it many times with Django Templates and Jinja templates. For example, some IDEs try to syntax highlight it as HTML when it's actually something entirely different.
If you can just heed the refactoring nit about the unit tests and write some why-comments about the stuff before and after .tostring()
then I'll approve and make a release.
Resolves #248
Description
Added
preserve_handlebar_syntax
option (Defaults toFalse
)"
between="{{
and}}"
in thehtml
string (prior to being encoded) with%22
.{{}}
(including%22
) will be decoded after the rest of the string has been encoded.unquote()
to decode everything between every pair of="%7B%7B
and%7D%7D"
(the encoded versions of{{
and}}
).Motivations
Additional Context
preserve_handlebar_syntax
because that's what @peterbe wrote in #248.I really enjoy working with this library and would appreciate any feedback because I am using this library in other projects.