{"id":31848846,"url":"https://github.com/matttuttle/hxwebtemplate","last_synced_at":"2026-02-17T03:35:59.231Z","repository":{"id":5664135,"uuid":"6873527","full_name":"MattTuttle/HxWebTemplate","owner":"MattTuttle","description":"A haxe template parser for html similar to Django","archived":false,"fork":false,"pushed_at":"2015-04-01T03:44:39.000Z","size":138,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-12T10:54:31.690Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haxe","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MattTuttle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-11-26T22:19:18.000Z","updated_at":"2017-02-27T12:09:07.000Z","dependencies_parsed_at":"2022-09-12T19:51:10.859Z","dependency_job_id":null,"html_url":"https://github.com/MattTuttle/HxWebTemplate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MattTuttle/HxWebTemplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MattTuttle%2FHxWebTemplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MattTuttle%2FHxWebTemplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MattTuttle%2FHxWebTemplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MattTuttle%2FHxWebTemplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MattTuttle","download_url":"https://codeload.github.com/MattTuttle/HxWebTemplate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MattTuttle%2FHxWebTemplate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29532437,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T03:01:11.216Z","status":"ssl_error","status_checked_at":"2026-02-17T03:00:31.803Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-10-12T10:52:27.592Z","updated_at":"2026-02-17T03:35:59.201Z","avatar_url":"https://github.com/MattTuttle.png","language":"Haxe","funding_links":[],"categories":[],"sub_categories":[],"readme":"Template Parser\n=======================\n\nThis is a template parsing class written in haxe. The intent is to use this in a web framework for parsing html documents although it can be used for plain text as well. The syntax is very similar to Django's template parser.\n\nThe parser is very simple to use and could be plugged into any framework. Here is a quick example.\n\n```haxe\nclass Main\n{\n\tpublic static function runTemplate(path:String, ?context:Dynamic):String\n\t{\n\t\tvar html = sys.io.File.getContent(path); // get template from a file\n\t\tvar tpl = new Template(html); // parses the template\n\t\treturn tpl.render(context); // renders the output with any data passed\n\t}\n\n\tpublic static function main()\n\t{\n\t\trunTemplate('index.html', {title: 'Home Page'});\n\t}\n\n}\n```\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\t\u003chead\u003e\n\t\t\u003ctitle\u003e{{ title }}\u003c/title\u003e\n\t\u003c/head\u003e\n\t\u003cbody\u003e{% block content %}This is the home page{% end %}\u003c/body\u003e\n\u003c/html\u003e\n```\n\nYou'll notice that the title information was passed to the template through an object. There is also a block defined as \"content\". This helps when you want to extend another template. Blocks can be overridden to allow for new content to be placed in them. By doing so you can easily create base templates and extend them for child pages.\n\nBeyond that there are also flow statements and filters that can be applied to your templates. Here is a brief example below to demonstrate what I mean.\n\n```html\n{% extends \"base.html\" %}\n\n{% block content %}\n\u003cp\u003eI am overriding the base content block here\u003c/p\u003e\n\u003cdiv class=\"post\"\u003e\n{% filter addslashes %}\n\t{% for post in posts %}\n\t\t\u003ch2\u003e{{ post.title|striptags }}\u003c/h2\u003e\n\t\t\u003cp\u003e{{ post.body }}\u003c/p\u003e\n\t\t{% if (post.comments != null) %}\n\t\t\u003cspan\u003e{{ post.comments }}\u003c/span\u003e\n\t\t{% end %}\n\t{% end %}\n{% end %}\n\u003c/div\u003e\n{% end %}\n```\n\nHere we are replacing the \"content\" block with a different value. This example shows how we could start to lay out a blog by looping through all of the posts. This would require the posts variable to be set when we call the runTemplate function defined above. You might have seen the filter striptags after post.title. This will strip any html tags from the title field.\n\nThere are a bunch of different filters available to use. These can be used for individual variables or for whole blocks. For now check out the addFilter function for a list of filters you can use. Also, you can easily add your own filters (markdown, textile, etc...).\n\nHopefully this gives you enough to get started. Happy coding!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatttuttle%2Fhxwebtemplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatttuttle%2Fhxwebtemplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatttuttle%2Fhxwebtemplate/lists"}