sipin / gorazor

Razor view engine for go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Escaping doesn't work well

clinyong opened this issue · comments

commented

@variable will automatically escape the variable, but I found that the escaping doesn't work in layout.

commented

The template file, it depends on the layout.

@{
    import {
        "tpl/user/layout/base"
    }

    <div>
        @user.Name
    </div>
}

The layout file, base.gohtml

@{
    var body string
}

<!DOCTYPE html>
<html lang="en">
    <head></head>
    <body>
       @body
       <div>@user.Name</div>
    </body>
</html>

If user.Name is Leo<div> , in the layout file, the @body is Leo&lt;div&gt;, but the @user.Name is Leo<div>.

fixed in 832cad0