Go 模板引擎 Pongo2gin

码农软件 · 软件分类 · 模板引擎 · 2019-08-22 19:58:36

软件介绍

Pongo2gin 是一个支持 Gin Web 框架的 Go 模板引擎。它可以与 Gin Web 框架一起使用,并使用了 Pongo2 模板引擎。

基础示例

import (
    "github.com/gin-gonic/gin"
    "github.com/flosch/pongo2"
    "github.com/robvdl/pongo2gin"
)

func main() {
    router := gin.Default()

    // Use pongo2gin.Default() for default options or pongo2gin.New()
    // if you need to use custom RenderOptions.
    router.HTMLRender = pongo2gin.Default()

    router.GET("/", func(c *gin.Context) {
        // Use pongo2.Context instead of gin.H
        c.HTML(200, "hello.html", pongo2.Context{"name": "world"})
    })

    router.Run(":8080")
}

本文地址:https://codercto.com/soft/d/12948.html

Weaving the Web

Weaving the Web

Tim Berners-Lee / Harper Paperbacks / 2000-11-01 / USD 15.00

Named one of the greatest minds of the 20th century by Time , Tim Berners-Lee is responsible for one of that century's most important advancements: the world wide web. Now, this low-profile genius-wh......一起来看看 《Weaving the Web》 这本书的介绍吧!

SHA 加密
SHA 加密

SHA 加密工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试