Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable html escaping in overlay templates #837

Merged
merged 1 commit into from
Nov 23, 2020
Merged

Conversation

galdor
Copy link
Contributor

@galdor galdor commented Nov 21, 2020

The mustache template engine escapes HTML entities by default. This is quite
annoying since we are not generating HTML pages in a web application. This
problem was already referenced in
#497. Now that bbmustache supports a way
to disable escaping by default, there is no reason not to do it.

Additionally, escaping is already disabled in rebar3 templates (see
fe8626ff7de635cc84da61b8b3deb553fe9572c9), so having both templating systems
behave the same way makes sense.

The mustache template engine escapes HTML entities by default. This is quite
annoying since we are not generating HTML pages in a web application. This
problem was already referenced in
erlware#497. Now that bbmustache supports a way
to disable escaping by default, there is no reason not to do it.

Additionally, escaping is already disabled in rebar3 templates (see
fe8626ff7de635cc84da61b8b3deb553fe9572c9), so having both templating systems
behave the same way makes sense.
@tsloughter
Copy link
Member

Yup, thanks! I think this is to safe to merge as is, but I'm not sure how all people have been using overlays so worry it might need to be possible to re-enable escaping.

@ferd
Copy link
Collaborator

ferd commented Nov 21, 2020

I would merge it. I can't imagine people generate HTML templates with relx more often than regular use cases for that and my bet is that we can treat escaping as a bug.

@lrascao
Copy link
Collaborator

lrascao commented Nov 21, 2020

i had to do something (can't remember what exactly) in my overlays that was related with escaping, can we hold on this one a bit while I find what it is exactly?

@tsloughter
Copy link
Member

@lrascao yea, no problem.

@lrascao lrascao self-requested a review November 23, 2020 16:58
@lrascao
Copy link
Collaborator

lrascao commented Nov 23, 2020

👍 , all good, i remembered what i do in cases where i don't want escaping to happen: i wrap the overlay in triple mustaches:

7> bbmustache:render(<<"{{{name}}}">>, [{name, "\"hoge"}], [{key_type, atom}]).
<<"\"hoge">>

@ferd ferd merged commit a24ec73 into erlware:master Nov 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants