{"id":18370184,"url":"https://github.com/docwhat/temple","last_synced_at":"2025-04-06T18:32:48.001Z","repository":{"id":14064001,"uuid":"64457558","full_name":"docwhat/temple","owner":"docwhat","description":"Sick of sed? Prosaic about perl? Use temple to substitute your variables!","archived":false,"fork":false,"pushed_at":"2024-10-13T21:46:58.000Z","size":202,"stargazers_count":14,"open_issues_count":9,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-22T04:51:14.763Z","etag":null,"topics":["go","golang","substitute","template"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/docwhat.org/temple","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/docwhat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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-07-29T06:47:49.000Z","updated_at":"2025-01-31T09:51:04.000Z","dependencies_parsed_at":"2024-11-05T23:49:19.158Z","dependency_job_id":null,"html_url":"https://github.com/docwhat/temple","commit_stats":{"total_commits":90,"total_committers":5,"mean_commits":18.0,"dds":0.05555555555555558,"last_synced_commit":"c73344b285f1bb649061f3f6a6491262bb82ac8e"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docwhat%2Ftemple","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docwhat%2Ftemple/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docwhat%2Ftemple/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docwhat%2Ftemple/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/docwhat","download_url":"https://codeload.github.com/docwhat/temple/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247531430,"owners_count":20953962,"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":["go","golang","substitute","template"],"created_at":"2024-11-05T23:36:58.920Z","updated_at":"2025-04-06T18:32:47.480Z","avatar_url":"https://github.com/docwhat.png","language":"Go","readme":"# Temple\n\n\u003e Sick of `sed`? Peaked about `perl`? Use `temple` to substitute your variables!\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/docwhat/temple/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/release/docwhat/temple.svg\" alt=\"GitHub release\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/docwhat/temple/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/docwhat/temple\" alt=\"GitHub license\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://godoc.org/docwhat.org/temple\"\u003e\u003cimg src=\"https://img.shields.io/badge/godoc-reference-blue.svg\" alt=\"GoDoc reference example\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/docwhat/temple\"\u003e\u003cimg src=\"https://img.shields.io/github/go-mod/go-version/docwhat/temple.svg\" alt=\"Go version\" /\u003e\u003c/a\u003e\n    \u003c/br\u003e\n    \u003cimg src=\"https://github.com/docwhat/temple/actions/workflows/release.yaml/badge.svg\" alt=\"release status\" /\u003e\n    \u003cimg src=\"https://github.com/docwhat/temple/actions/workflows/checks.yaml/badge.svg?branch=main\u0026amp;event=push\" alt=\"main branch status\" /\u003e\n    \u003ca href=\"https://goreportcard.com/report/docwhat.org/temple\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/docwhat/temple\" alt=\"Go Report Card\" /\u003e\u003c/a\u003e\n    \u003c/br\u003e\n    \u003ca href=\"http://makeapullrequest.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square\" alt=\"PRs Welcome\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://GitHub.com/docwhat/temple/graphs/contributors/\"\u003e\u003cimg src=\"https://img.shields.io/github/contributors/docwhat/temple.svg\" alt=\"GitHub contributors\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/docwhat/temple/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/docwhat/temple.svg\" alt=\"GitHub issues\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Installation\n\n### Binaries\n\nI have pre-built binaries for several platform already. They are available on the [releases page](https://github.com/docwhat/temple/releases).\n\n### Source\n\nIf you have go v1.6 installed, then you can build the binary with the following command:\n\n```bash\ngo install docwhat.org/temple\n```\n\n## Usage\n\n    Usage: temple \u003ctemplate-file\u003e\n\n    A simple templating engine\n\n    Arguments:\n      \u003ctemplate-file\u003e    The template file to use ($TEMPLE_TEMPLATE_FILE)\n\n    Flags:\n      -h, --help              Show context-sensitive help.\n          --version           Show version information\n      -d, --data=DATA-FILE    A YAML or JSON file to use via the {{data.\u003cfoo\u003e}} interface ($TEMPLE_DATA_FILE)\n      -H, --html              Use HTML templating instead of text templating ($TEMPLE_USE_HTML)\n\nNote that the `DATA` file must have an object at the top level. You cannot use a bare string or an array.\n\nJSON Example:\n\n```json\n{\n  \"key\": \"value\",\n  \"key2\": 2\n}\n```\n\nYAML Example:\n\n```yaml\nkey: \"value\"\nkey2: 2\n```\n\n## Template Syntax\n\nFor complete documentation, read go's [text/template](https://golang.org/pkg/text/template/) and [html/template](https://golang.org/pkg/html/template/).\n\n### Sprig Functions\n\nTemple supports the complete list of [Sprig functions](http://masterminds.github.io/sprig/).\n\n### Data Sources\n\n* `{{hostname}}` -- The systems fully qualified domain name.\n* `{{uid}}` -- `UID` of the user running `temple`.\n* `{{gid}}` -- `GID` of the user running `temple`.\n* `{{euid}}` -- Effective `UID` of the user running `temple`.\n* `{{egid}}` -- Effective `GID` of the user running `temple`.\n* `{{pwd}}` -- The current working directory.\n* `{{json}}` -- Access to your JSON data. Use dot notation to get access to items. e.g. `{{json.authors.greenwood.first_name}}`\n\n### Functions\n\n* `{{index \u003cexpr\u003e 99}}` -- The 99th item of the array `\u003cexpr\u003e`.\n* `{{\u003cexpr\u003e | js}}` -- `\u003cexpr\u003e` escaped/quoted for JavaScript \u0026 JSON.\n* `{{\u003cexpr\u003e | html}}` -- `\u003cexpr\u003e` escaped/quoted for HTML.\n* `{{\u003cexpr\u003e | urlquery}}` -- `\u003cexpr\u003e` escaped/quoted for a URL quoting. i.e. replacing spaces with `+` and using `%NN` syntax.\n* `{{\u003cexpr\u003e | shellquote}}` -- `\u003cexpr\u003e` escaped/quoted for POSIX shells.\n* `{{\u003cexpr\u003e | len}}` -- The length of the `\u003cexpr\u003e`.\n\n### Flow Control\n\n* `{{if \u003cexpr\u003e}}true string{{else}}false string{{end}}` -- If/Else syntax. The `{{else}}` is optional.\n* `{{range \u003carray\u003e}} item: {{.}} {{else}} The list is empty {{end}}` -- Iterate over `\u003carray\u003e`. The `{{else}}` is optional.\n\n### Miscellaneous\n\n* `{{\u003cexpr\u003e -}}` -- Trim whitespace to the right. e.g. `{{1 -}} .0` becomes `1.0`.\n* `{{- \u003cexpr\u003e}}` -- Trim whitespace to the left.\n* `{{- \u003cexpr\u003e -}}` -- Trim whitespace to the right and left.\n* `{{/* comment */}}` -- Comments!\n\n## Related Projects\n\n* [gomplate](https://github.com/hairyhenderson/gomplate)\n\n## Thanks\n\n* [@alecthomas](https://github.com/alecthomas) for [kingpin](https://github.com/alecthomas/kingpin)\n* [@kballard](https://github.com/kballard) for [go-shellquote](https://github.com/kballard/go-shellquote)\n* [@seh](https://github.com/seh) for Go help\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocwhat%2Ftemple","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdocwhat%2Ftemple","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocwhat%2Ftemple/lists"}