{"id":34976415,"url":"https://github.com/pvormste/atempgo","last_synced_at":"2026-05-22T00:08:31.974Z","repository":{"id":22502746,"uuid":"25842361","full_name":"pvormste/atempgo","owner":"pvormste","description":"Automatic Template Parser for Go","archived":false,"fork":false,"pushed_at":"2014-10-30T14:03:46.000Z","size":172,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-20T03:35:11.502Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pvormste.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}},"created_at":"2014-10-27T22:35:08.000Z","updated_at":"2014-10-28T00:10:40.000Z","dependencies_parsed_at":"2022-08-21T04:01:01.789Z","dependency_job_id":null,"html_url":"https://github.com/pvormste/atempgo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pvormste/atempgo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvormste%2Fatempgo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvormste%2Fatempgo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvormste%2Fatempgo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvormste%2Fatempgo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pvormste","download_url":"https://codeload.github.com/pvormste/atempgo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvormste%2Fatempgo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28065896,"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","status":"online","status_checked_at":"2025-12-26T02:00:06.189Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-12-27T00:13:44.513Z","updated_at":"2025-12-27T00:13:45.192Z","avatar_url":"https://github.com/pvormste.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Atempgo\n==============\n\nAtempgo is an Automatic TEMplate Parser for GO. \n\n## Install\n\n```go\ngo get github.com/pvormste/atempgo\n```\n \n \n## Features\n\n * Automatically parses view templates\n * Simulates template inheritance (as described at [StackOverflow](http://stackoverflow.com/questions/11467731/is-it-possible-to-have-nested-templates-in-go-using-the-standard-library-googl))\n * Generates easy keys for accessing the templates\n\n## How does it work?\n\n### Structure (example)\n```\nviews/\n├── SplashSite/\n│   ├── index.html\n│   ├── index-login.html\n|   ├── index-register.html\n|   └── SubSplashFolder/\n|       └── start.html\n|\n├── nonbase/\n│   ├── superspecial.html\n|   └── superspecial-content.html\n|\n└── base.html\n```\n\n### Note:\n\n  * base.html must be located in the root\n  * Views, which doesn't extend a base-view, must be located in specific folder (See ParseOptions)\n  * Inherited templates must use a delimiter specified in the ParseOptions (default \"-\")\n  * File extensions  should be all the same (html, tmpl, ...)\n  * Child template must be located in same folder as parent\n  * Hash (#) is short form of: extends base -\u003e base.index.login is written as #index.login\n  * If key starts with Hash (#), you have to pass the BaseName value (default: base), else: the first parent\n  * Because of go template design, you can only call the last child, not a single parent (e.g. \"#index.login\" not \"#index\")\n\n### Config\n\nYou can overwrite the default parse options by creating a new ParseOptions struct. Example:\n\n```go\n// There also exists a DefaultParseOptions struct (see \"As code\" section below)\npOpt := \u0026atempgo.ParseOptions{\n\tBaseName: \"layout\",\t\t\t// default: \"base\"\n\tDelimiter: \"+\",\t\t\t\t// default: \"-\"\n    Ext: \"tmpl\",\t\t\t\t// default: \"html\"\n    NonBaseFolder: \"single\",\t// default: \"nonbase\"\n}\n```\n  \n### As code\n\n```go\nimport (\n\t\"github.com/pvormste/atempgo\"\n    \"path/filepath\"\n)\n\nfunc init() {\n\t// Parameters: Path to base file (e.g. path/to/folder/with/basefile), parse options (e.g. DefaultParseOptions)\n\tatempgo.LoadTemplates(filepath.Join(\"path\", \"to\", \"folder\", \"with\", \"basefile\"), atempgo.DefaultParseOptions)\n}\n```\n\n```go\nimport (\n\t\"net/http\"\n\t\"github.com/pvormste/atempgo\"\n)\n\n// The Hash (#) means, that the view extends base view.\n// So \"base\" must be executed. \nfunc HandleLogin(w http.ResponseWriter, r *http.Request) {\n\tatempgo.GetTemplate(\"#index.login\").ExecuteTemplate(w, \"base\", nil)\n}\n\nfunc HandleRegister(w http.ResponseWriter, r *http.Request) {\n\tatempgo.GetTemplate(\"#index.register\").ExecuteTemplate(w, \"base\", nil)\n}\n\n// No Hash (#) indicates, that it doesn't extends the base view.\n// In this case, it must render the first named part of the key (\"superspecial\").\nfunc HandleSuperspecialWithContent(w http.ResponseWriter, r *http.Request) {\n\tatempgo.GetTemplate(\"superspecial.content\").ExecuteTemplate(w, \"superspecial\", nil)\n}\n```\n\n## Roadmap\n\n  * Code is not optimized. Just was an idea if it works. Maybe someone can rethink about it.\n  * Add support to call views by path\n\n## LICENSE (MIT)\n\nThe MIT License (MIT)\n\nCopyright (c) 2014 Patric \"pvormste\" Vormstein\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpvormste%2Fatempgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpvormste%2Fatempgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpvormste%2Fatempgo/lists"}