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 smart escaping #36

Open
pavel-chumakou opened this issue Nov 11, 2015 · 4 comments
Open

Disable smart escaping #36

pavel-chumakou opened this issue Nov 11, 2015 · 4 comments

Comments

@pavel-chumakou
Copy link

It seems disabling of smart escaping doesn't work.

I'm using the following code:

    Map<String, Object> map = new HashMap<String, Object>();
    map.put("feature.smart_escape.enabled", false);
    RythmEngine engine = new RythmEngine(map);
    System.out.println(engine.conf().smartEscapeEnabled()); // false

    String main = engine.render(".\\src\\main\\resources\\templates\\test.html", "Rythm", "line 1 <br> line 2");

Where test.html is simple html template.

Output contains: line1 & lt ; br & gt ; line 2

But I need the following output: .... line1 <br> line 2 ....

Is this is a bug? If no, please advice how to disable smart escaping. Maybe I need to configure some another parameters?

@greenlaw110
Copy link
Collaborator

For the sake of security, content is always escaped. Note this is not about smart escape, but escape.

What's the content of your "test.html" template?

@pavel-chumakou
Copy link
Author

Content of "test.html" is:
@args String title, String body;
`

<title>@title</title> @Body `

@greenlaw110
Copy link
Collaborator

try this:

@args String title, String body;
<html> <head> <title>@title</title> </head> <body> @body.raw() </body> </html>

@pavel-chumakou
Copy link
Author

It works! Thank you very much!
I think it would be useful to mention about raw() on "Builtin Transformers" page.

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

No branches or pull requests

2 participants