{"id":21502378,"url":"https://github.com/night-codes/go-gin-ttpl","last_synced_at":"2025-07-15T22:32:48.619Z","repository":{"id":83544882,"uuid":"52248410","full_name":"night-codes/go-gin-ttpl","owner":"night-codes","description":"Custom render for gin-gonic by \"text/template\" instead \"html/template\"  ","archived":false,"fork":false,"pushed_at":"2018-08-14T12:21:43.000Z","size":4,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T05:09:15.894Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/night-codes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-22T05:03:03.000Z","updated_at":"2022-10-09T16:11:36.000Z","dependencies_parsed_at":"2023-07-07T17:45:13.422Z","dependency_job_id":null,"html_url":"https://github.com/night-codes/go-gin-ttpl","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/night-codes%2Fgo-gin-ttpl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/night-codes%2Fgo-gin-ttpl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/night-codes%2Fgo-gin-ttpl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/night-codes%2Fgo-gin-ttpl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/night-codes","download_url":"https://codeload.github.com/night-codes/go-gin-ttpl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226077479,"owners_count":17570164,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-23T18:14:43.260Z","updated_at":"2024-11-23T18:14:43.928Z","avatar_url":"https://github.com/night-codes.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-gin-ttpl\nCustom render for gin-gonic by \"text/template\" instead \"html/template\"  \n\n## Why Do It?\nSometimes we need to render templates without HTML. Also \"html/template\" has the [problem](https://github.com/golang/go/issues/12149) with parser.\n\n## How To Use\n```go\npackage main\n\nimport (\n    \"gopkg.in/gin-gonic/gin.v1\"\n    \"gopkg.in/night-codes/go-gin-ttpl.v1\"\n)\n\nfunc main() {\n    r := gin.New()\n    ttpl.Use(r, \"templates/*\")\n    r.GET(\"/\", func(c *gin.Context) {\n        c.HTML(200, \"index.html\", gin.H{\"title\": \"top\"})\n    })\n    r.Run(\":41000\")\n}\n```\n\nWhen you want to add your own template functions you can pass a third parameter - FuncMap\n\n```go\nimport (\n    // ...\n    \"text/template\"\n)\n\nfunc main() {\n    // ...\n    funcMap := template.FuncMap{\n        \"customFunc\": customFunc, // A custom template function\n    }\n    ttpl.Use(r, \"templates/*\", funcMap) // \u003c--\n    // ...\n}\n```\n\n\n## License\nDO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE\nVersion 2, December 2004\n\nCopyright (C) 2015 Oleksiy Chechel \u003calex.mirrr@gmail.com\u003e\n\nEveryone is permitted to copy and distribute verbatim or modified\ncopies of this license document, and changing it is allowed as long\nas the name is changed.\n\nDO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE\nTERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n 0. You just DO WHAT THE FUCK YOU WANT TO.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnight-codes%2Fgo-gin-ttpl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnight-codes%2Fgo-gin-ttpl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnight-codes%2Fgo-gin-ttpl/lists"}