shiyanhui / hero

A handy, fast and powerful go template engine.
https://shiyanhui.github.io/hero
Other
1.57k stars 96 forks source link

[improvement] html 缩进希望能和源文件一致 #80

Open fanybook opened 4 years ago

fanybook commented 4 years ago

有 include 页面时,缩进表现的不好,现在貌似被 gofmt 格式化过,除了缩进还有没用的多余空行

预期的效果,是能尽量保持 .html 的缩进

现在的表现: userlist.html.go

    for _, user := range userList {
        buffer.WriteString(`
        <ul>
            `)
        buffer.WriteString(`<li>
    `)
        hero.EscapeHTML(user, buffer)
        buffer.WriteString(`
</li>
`)
        buffer.WriteString(`
        </ul>
    `)
    }

Response

        <ul>
            <li>
    Alice
</li>

        </ul>

        <ul>
            <li>
    Bob
</li>

        </ul>

        <ul>
            <li>
    Tom
</li>

        </ul>